#P1690B. Array Decrements

    ID: 7651 Type: RemoteJudge 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>greedyimplementation*800

Array Decrements

No submission language available for this problem.

Description

Kristina has two arrays aa and bb, each containing nn non-negative integers. She can perform the following operation on array aa any number of times:

  • apply a decrement to each non-zero element of the array, that is, replace the value of each element aia_i such that ai>0a_i > 0 with the value ai1a_i - 1 (1in1 \le i \le n). If aia_i was 00, its value does not change.

Determine whether Kristina can get an array bb from an array aa in some number of operations (probably zero). In other words, can she make ai=bia_i = b_i after some number of operations for each 1in1 \le i \le n?

For example, let n=4n = 4, a=[3,5,4,1]a = [3, 5, 4, 1] and b=[1,3,2,0]b = [1, 3, 2, 0]. In this case, she can apply the operation twice:

  • after the first application of the operation she gets a=[2,4,3,0]a = [2, 4, 3, 0];
  • after the second use of the operation she gets a=[1,3,2,0]a = [1, 3, 2, 0].

Thus, in two operations, she can get an array bb from an array aa.

The first line of the input contains an integer tt (1t1041 \le t \le 10^4) —the number of test cases in the test.

The descriptions of the test cases follow.

The first line of each test case contains a single integer nn (1n51041 \le n \le 5 \cdot 10^4).

The second line of each test case contains exactly nn non-negative integers a1,a2,,ana_1, a_2, \dots, a_n (0ai1090 \le a_i \le 10^9).

The third line of each test case contains exactly nn non-negative integers b1,b2,,bnb_1, b_2, \dots, b_n (0bi1090 \le b_i \le 10^9).

It is guaranteed that the sum of nn values over all test cases in the test does not exceed 21052 \cdot 10^5.

For each test case, output on a separate line:

  • YES, if by doing some number of operations it is possible to get an array bb from an array aa;
  • NO otherwise.

You can output YES and NO in any case (for example, strings yEs, yes, Yes and YES will be recognized as a positive response).

Input

The first line of the input contains an integer tt (1t1041 \le t \le 10^4) —the number of test cases in the test.

The descriptions of the test cases follow.

The first line of each test case contains a single integer nn (1n51041 \le n \le 5 \cdot 10^4).

The second line of each test case contains exactly nn non-negative integers a1,a2,,ana_1, a_2, \dots, a_n (0ai1090 \le a_i \le 10^9).

The third line of each test case contains exactly nn non-negative integers b1,b2,,bnb_1, b_2, \dots, b_n (0bi1090 \le b_i \le 10^9).

It is guaranteed that the sum of nn values over all test cases in the test does not exceed 21052 \cdot 10^5.

Output

For each test case, output on a separate line:

  • YES, if by doing some number of operations it is possible to get an array bb from an array aa;
  • NO otherwise.

You can output YES and NO in any case (for example, strings yEs, yes, Yes and YES will be recognized as a positive response).

Samples

Sample Input 1

6
4
3 5 4 1
1 3 2 0
3
1 2 1
0 1 0
4
5 3 7 2
1 1 1 1
5
1 2 3 4 5
1 2 3 4 6
1
8
0
1
4
6

Sample Output 1

YES
YES
NO
NO
YES
NO

Note

The first test case is analyzed in the statement.

In the second test case, it is enough to apply the operation to array aa once.

In the third test case, it is impossible to get array bb from array aa.