Interesting Scoring Systems

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

문제

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 vv to player uu if player vv won at least one game against player uu. Then Cardano states that a player vv wins the tournament only if in the graph of the tournament there is a path from vv to everyone else and there is none from any other player to vv.

Recently, there has been a chess tournament of nn players, numbered from 00 to n1n-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 00 won the tournament according to Cardano's criteria.

입력

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

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

The second line contains nn integers a_0,a_1,,a_n1a\_0, a\_1, \dots, a\_{n-1} (0a_i1090 \leq a\_i \leq 10^9), where a_ia\_i is the number of points player ii has obtained according to Abel's criteria.

The third line contains nn integers b_0,b_1,,b_n1b\_0, b\_1, \dots, b\_{n-1} (0b_i1090 \leq b\_i \leq 10^9), where b_ib\_i is the number of points player ii has obtained according to Bolzano's criteria.

The sum of nn for all test cases won't exceed 10610^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 00 won the tournament according to Cardano's criteria. Otherwise, print a line with the word "NO".