#CF1107D. An Alternative Way 另一种方式

An Alternative Way 另一种方式

当前没有测试数据。

CF测试跳转:https://codeforces.com/contest/2241/problem/D

You are given two arrays aa and bb, each of length nn. You are allowed to perform the following operation on array aa any number of times (including zero):

  1. Choose two indices ll and rr such that 1lrn1 \le l \le r \le n;
  2. For each index ii from ll to rr (both inclusive),
    • Set ai:=ai1a_i := a_i - 1 if ili - l is odd.
    • Set ai:=ai+1a_i := a_i + 1 if ili - l is even.

Determine whether you can make the array aa equal to the array bb by performing the operation any number of times.

Input

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases. Description of each test case follows.

The first line of each test case contains a single integer nn (1n21051 \le n \le 2\cdot10^5) — the length of the arrays aa and bb.

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1091 \le a_i \le 10^9) — the elements of the array aa.

The third line of each test case contains nn integers b1,b2,,bnb_1, b_2, \ldots, b_n (1bi1091 \le b_i \le 10^9) — the elements of the array bb.

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

Output

For each test case, print "YES" if you can make array aa equal to array bb and "NO" otherwise.

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

Example

7
3
1 2 3
1 2 3
4
1 4 5 2
1 5 4 3
1
9
8
6
6 7 6 7 6 7
7 6 7 6 7 6
9
9 8 7 6 5 4 3 2 1
9 9 8 2 4 4 3 5 3
3
1 1 2
2 1 1
2
1 2
1 1
YES
YES
NO
YES
NO
YES
NO

Note

For the first test case, arrays aa and bb are already equal.

For the second test case, let us choose l=2l = 2 and r=4r = 4. Now, we update the array aa in the following manner:

  • For i=2i = 2, we have il=22=0i - l = 2 - 2 = 0, which is even. Hence, set a2:=a2+1=4+1=5a_2 := a_2 + 1 = 4 + 1 = 5.
  • For i=3i = 3, we have il=32=1i - l = 3 - 2 = 1, which is odd. Hence, set a3:=a31=51=4a_3 := a_3 - 1 = 5 - 1 = 4.
  • For i=4i = 4, we have il=42=2i - l = 4 - 2 = 2, which is even. Hence, set a4:=a4+1=2+1=3a_4 := a_4 + 1 = 2 + 1 = 3.

Finally, we have array a=[1,5,4,3]a = [1, 5, 4, 3] and array b=[1,5,4,3]b = [1, 5, 4, 3].

For the third test case, it can be shown that it is impossible to make array aa equal to array bb.