Tianjin University Online Judge
Contests Virtual Contests Problems Submit Runs Status Rank List Forum

3247.   Final Guessing
Time Limit: 2.0 Seconds   Memory Limit: 65536K
Total Runs: 434   Accepted Runs: 109



The new season of UESTC programming contest is coming, before the contest, the lottery area in the BBS of stuhome give out a new lottery to forecast this year's most clever student in the UESTC!

As the odds is given, love8909 is 1:2,and stephydx is 1:3, which is to say if you buy one coin for love8909 and he win the contest, you will get two coins back, so that you will have earned one coin in this lottery!

lxhgww feels it is quite interesting, so now he comes to the stuhome BBS to buy the lottery, no one want to lose money, so dose him. Now, lxhgww wants to know whether there is a strategy to buy the lottery that he can always earn no matter who would be the winner of the contest!

Input

The first line of the input contains one integer T, which indicates the number of test cases. For each test case, in the first line an integer N meaning there are N people join the contest (N ≤ 105), then N lines are given, each line contains two integers A and B, the numbers in i-th line is indicating the i-th odds of contestants is A : B.

Output

Output "Yes" if lxhgww have a way to buy the lottery so that he can always win. Otherwise, output "No".

Sample Input

1
2
1 2
1 3

Sample Output

Yes

Hint:

If lxhgww buy 5 coins for the first person, and 4 coins for the second, so that he totally used 9 coins, and if the first person wins, he can get 10 coins back, if the second person wins, he can get 12 coins back. So that lxhgww can always win in this way.



Source: The 7th UESTC Programming Contest
Submit   List    Runs   Forum   Statistics

Tianjin University Online Judge v1.3.0
Maintance:Fxz. Developer: SuperHacker, G.D.Retop, Fxz