시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB71202029.851%

문제

Score in chess tournaments is a controversial topic. Abel likes the classical system: 2 points per win and 1 point per draw. Bolzano prefers the football way: 3 points per win and 1 point per draw. But Cardano doesn't like either way and has his own system to declare a winner. We define the graph of the tournament as the graph where each node represents a player and an edge goes from player $v$ to player $u$ if player $v$ won at least one game against player $u$. Then Cardano states that a player $v$ wins the tournament only if in the graph of the tournament there is a path from $v$ to everyone else and there is none from any other player to $v$.

Recently, there has been a chess tournament of $n$ players, numbered from $0$ to $n-1$. The only information we have is the number of points of each player according to Abel's and Bolzano's criteria. Each player might have played any number of times with any other player. Determine if it is possible that player $0$ won the tournament according to Cardano's criteria.

입력

The first line contains one integer $t$, the number of test cases ($1 \leq t \leq 10^4$). Each test case consists of three lines:

The first line of contains one integer $n$ ($1 \leq n \leq 10^6$), the number of participants in the tournament.

The second line contains $n$ integers $a_0, a_1, \dots, a_{n-1}$ ($0 \leq a_i \leq 10^9$), where $a_i$ is the number of points player $i$ has obtained according to Abel's criteria.

The third line contains $n$ integers $b_0, b_1, \dots, b_{n-1}$ ($0 \leq b_i \leq 10^9$), where $b_i$ is the number of points player $i$ has obtained according to Bolzano's criteria.

The sum of $n$ for all test cases won't exceed $10^6$.

It is guaranteed that the given scoring corresponds to a valid tournament.

출력

For each test case, print a line with the word "YES" if it is possible that player $0$ won the tournament according to Cardano's criteria. Otherwise, print a line with the word "NO".

예제 입력 1

2
3
4 1 1
6 1 1
4
5 1 1 1
7 1 1 1

예제 출력 1

YES
NO