Array transformation (change)

Description


There are two integer arrays \(A\) and \(B\) of length \(n\). The value of the array \(A\) will only be \(1, 0\) or \(-1\).
You can perform the following operations multiple times:
1. Choose any ordered pair \(\text{(i,j)}\) such that \(1\le i \lt j \le n\). You can select the same ordered pair \(\text{(i,j)}\) multiple times.
2. Add \(A[i]\) to \(A[j]\), that is, the \(j\) element of the array \(A\) is equal to \(A[i]+A[j]\).
For example, if the given array \(A\) is \([1,−1,0]\), you can transform it into \([1,−1,−1]\), \([1,0,0]\) and \([1,−1,1]\)in one operation.
The problem now is, given the arrays \(A\) and \(B\), determine whether a certain number (\(0\) or more) of these operations can be applied to the array \(A\) to make it equal to the array \(B\).

Format


Input

Contains multiple sets of test data. An integer \(T\) in the first line indicates the number of test data sets. Each set of test data contains:
The first line contains an integer \(n\), which represents the length of the array.
The second line contains \(n\) integers \(A[1], A[2], \cdots, A[n](-1\le A[i] \le 1)\) describe the \(A\) array.
The third line contains \(n\) integers \(B[1], B[2], \cdots, B[n](-10^9 \le B[i] \le 10^9)\) description array \(B\) .

Output

For each set of data output one line, if the arrays \(A\) and \(B\) can be made equal by performing the operations in the title description, then output YES, otherwise output NO.

Sample


Input

2
3
1 -1 0
1 1 -2
3
0 1 1
0 2 2

Output

YES
NO

Sample Explanation

In the first set of data, select the ordinal pair \(\text{(2,3)}\) to execute \(2\) times, and select the ordinal number pair \(\text{(1,2)}\) to execute \(2\) times, then the array \(A\) becomes the same as the array \(B\).

Hint


Data for \(100\%\): \(1 \le T \le 10000, 1 \le n \le 10^5\), make sure that the sum of \(n\) in multiple sets of data for each test point does not exceed \(10^5\).

Sample Code


Code is not available!
posted @ 2020-10-14 21:04  Sample_Test  阅读(172)  评论(0编辑  收藏  举报