시간 제한메모리 제한제출정답맞은 사람정답 비율
2 초 512 MB0000.000%

문제

Mr. Docriz has $n$ different kinds of objects indexed by $1, 2, \ldots, n$. An object of the $i$-th kind weighs $i$ kilograms. For each $i$, Mr. Docriz has $b_i$ objects of the $i$-th kind. Among those objects, there are $a_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 $k$, if we sort its elements by non-descending weight as $c_1, c_2, \ldots, c_k$, the median weight of this set is defined as the weight of $c_{\lfloor (k + 1) / 2 \rfloor}$.

입력

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

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

Then $n$ lines follow. The $i$-th of these lines contains two integers $a_i$ and $b_i$ ($0 \leq a_i \leq b_i \leq 10^9$), indicating that there are $a_i$ precious objects of the $i$-th kind, and $b_i$ objects of the $i$-th kind in total.

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

출력

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

예제 입력 1

3
4
1 1
1 1
1 1
1 1
4
1 1
0 1
1 1
1 1
4
0 1
1 1
1 1
1 1

예제 출력 1

YES
YES
NO