e-olymp
Competitions

Beginners contest: Loops - 2

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.

Input

The first line contains the number of test cases. Each test consists of a number n (1n100) of items that need to pass Valera. This is followed by n lines, each of which consists of two numbers a and b (1ab31), specify the interval of the regular teacher.

Output

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.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2
1
1 2
2 
1 2
3 4
Output example #1
YES
NO