Median

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Mr. Docriz has nn different kinds of objects indexed by 1,2,,n1, 2, \ldots, n. An object of the ii-th kind weighs ii kilograms. For each ii, Mr. Docriz has b_ib\_i objects of the ii-th kind. Among those objects, there are a_ia\_i precious objects, and the remaining ones are common objects. Now, he wants to divide all his objects into some (one or more) disjoint sets. These sets have to satisfy the following conditions:

  1. Each object should go to exactly one set.
  2. Each set should contain exactly one precious object.
  3. In each set, the weight of the precious object should be the median weight of this set.

Please tell him whether it is possible.

For a set of size kk, if we sort its elements by non-descending weight as c_1,c_2,,c_kc\_1, c\_2, \ldots, c\_k, the median weight of this set is defined as the weight of c_(k+1)/2c\_{\lfloor (k + 1) / 2 \rfloor}.

입력

The first line contains an integer TT (1T10001 \leq T \leq 1000), the number of test cases. Then TT test cases follow.

The first line of each test case contains one integer nn (1n1061 \leq n \leq 10^6), specifying how many different kinds of objects Mr. Docriz has. 

Then nn lines follow. The ii-th of these lines contains two integers a_ia\_i and b_ib\_i (0a_ib_i1090 \leq a\_i \leq b\_i \leq 10^9), indicating that there are a_ia\_i precious objects of the ii-th kind, and b_ib\_i objects of the ii-th kind in total.

It is guaranteed that n2106\sum n \leq 2 \cdot 10^6.

출력

For each test case, output "YES" if it is possible to achieve the goal, or "NO" otherwise.