eolymp
bolt
Try our new interface for solving problems
Problems

Lazybones

Lazybones

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. \InputFile The first line contains the number of test cases. Each test consists of a number $n~(1 \le n \le 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 \le a \le b \le 31)$, specify the interval of the regular teacher. \OutputFile For each test print in a separate line "\textbf{YES}" if it is possible to meet all the teachers at one day, or "\textbf{NO}", if this is impossible.
Time limit 1 second
Memory limit 128 MiB
Input example #1
2
4
1 7
4 5
3 8
5 10
2 
1 2
3 4
Output example #1
YES
NO