PP1 Week 3 Contest 2
Student Valera is a classic example of the idler. In classes, he almost did not go, and only appears at the end of the semester at the university and deliver "tails". His dream: to find a day when it will be possible to pass at once all the debts. He has a schedule of work for teachers, of whom know exactly what to and what day of the month, each teacher will be available daily. Help Valera write a program that is scheduled to determine whether Valera pass all debts in one day or not.
The first line contains the number of test cases. Each test consists of a number n (1 ≤ n ≤ 100) of items that need to pass Valera. This is followed by n lines, each of which consists of two numbers a and b (1 ≤ a ≤ b ≤ 31), specify the interval of the regular teacher.
For each test print in a separate line "YES" if it is possible to meet all the teachers at one day, or "NO", if this is impossible.
2 1 1 2 2 1 2 3 4