Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem:

There are two arrays of integers $a$ and $b$ of length $n$. It turned out that array $a$ contains only elements from the set $\{-1, 0, 1\}$.

Anton can perform the following sequence of operations any number of times:  Choose any pair of indexes $(i, j)$ such that $1 \le i < j \le n$. It is possible to choose the same pair $(i, j)$ more than once.   Add $a_i$ to $a_j$. In other words, $j$-th element of the array becomes equal to $a_i + a_j$. 

For example, if you are given array $[1, -1, 0]$, you can transform it only to $[1, -1, -1]$, $[1, 0, 0]$ and $[1, -1, 1]$ by one operation.

Anton wants to predict if it is possible to apply some number (zero or more) of these operations to the array $a$ so that it becomes equal to array $b$. Can you help him?


-----Input-----

Each test contains multiple test cases. 

The first line contains the number of test cases $t$ ($1 \le t \le 10000$). The description of the test cases follows.

The first line of each test case contains a single integer $n$ ($1 \le n \le 10^5$)  — the length of arrays.

The second line of each test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($-1 \le a_i \le 1$)  — elements of array $a$. There can be duplicates among elements.

The third line of each test case contains $n$ integers $b_1, b_2, \dots, b_n$ ($-10^9 \le b_i \le 10^9$)  — elements of array $b$. There can be duplicates among elements.

It is guaranteed that the sum of $n$ over all test cases doesn't exceed $10^5$.


-----Output-----

For each test case, output one line containing "YES" if it's possible to make arrays $a$ and $b$ equal by performing the described operations, or "NO" if it's impossible.

You can print each letter in any case (upper or lower).


-----Example-----
Input
5
3
1 -1 0
1 1 -2
3
0 1 1
0 2 2
2
1 0
1 41
2
-1 0
-1 -41
5
0 1 -1 1 -1
1 1 -1 1 -1

Output
YES
NO
YES
YES
NO



-----Note-----

In the first test-case we can choose $(i, j)=(2, 3)$ twice and after that choose $(i, j)=(1, 2)$ twice too. These operations will transform $[1, -1, 0] \to [1, -1, -2] \to [1, 1, -2]$

In the second test case we can't make equal numbers on the second position.

In the third test case we can choose $(i, j)=(1, 2)$ $41$ times. The same about the fourth test case.

In the last lest case, it is impossible to make array $a$ equal to the array $b$.

Difficulty: interview

Starter code:

Solutions:
from math import *

mod = 1000000007

for zz in range(int(input())):
    n = int(input())
    a = [ int(i) for i in input().split()]
    b = [int(i) for i in input().split()]
    ha = True
    hp = False
    hm = False
    for i in range(n):
        if b[i] != a[i]:
            if b[i] > a[i]:
                if (hp):
                    pass
                else:
                    ha = False
                    break
            else:
                if (hm):
                    pass
                else:
                    ha = False
                    break
        if a[i] > 0:
            hp = True
        elif a[i] < 0:
            hm = True

    if ha:
        print('YES')
    else:
        print('NO')


t = int(input())
for i in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    d1 = False
    d2 = False
    ans = True
    for j in range(n):
        if a[j] > b[j]:
            if not d1:
                ans = False
        if a[j] < b[j]:
            if not d2:
                ans = False
        if a[j] == -1:
            d1 = True
        elif a[j] == 1:
            d2 = True
    if ans:
        print("YES")
    else:
        print("NO")

import sys
input = sys.stdin.readline

t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    pos = neg = False
    ok = True
    for i in range(n):
        if a[i] > b[i] and not neg:
            ok = False
            break
        if a[i] < b[i] and not pos:
            ok = False
            break
        if a[i] == -1:
            neg = True
        if a[i] == 1:
            pos = True
    print('YES' if ok else 'NO')

from math import *



for t in range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    cnt1 = 0
    cnt0 = 0
    cntotr = 0
    f = True
    for i in range(n):
        if a[i] > b[i]:
            if cntotr == 0:
                f = False
                break
        if a[i] < b[i]:
            if cnt1 == 0:
                f = False
                break
        if a[i] == 0:
            cnt0 += 1
        elif a[i] == 1:
            cnt1 += 1
        else:
            cntotr += 1
    if f:
        print("YES")
    else:
        print("NO")

















t = int(input())
for _ in range(t):
    n = int(input())
    A = map(int, input().split())
    B = map(int, input().split())
    
    seen_pos = seen_neg = False
    for a, b in zip(A, B):
        if (b > a and not seen_pos) or (b < a and not seen_neg):
            print('NO')
            break
        
        if a > 0:
            seen_pos = True
        elif a < 0:
            seen_neg = True        
    else:
        print('YES')

import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""

t=ii()
for _ in range(t):
    x=ii()
    a=ll()
    b=ll()
    one=-1
    minus=-1
    f=0
    for i in range(x):
        if(b[i]>a[i]):
            if(one==-1):
                f=1
                break
        elif (b[i]<a[i]):
            if(minus==-1):
                f=1
                break
        if(a[i]==1):
            one=1
        elif(a[i]==-1):
            minus=1
    if(f):
        print("NO")
    else:
        print("YES")

t=int(input())
for _ in range(t):
    n=int(input())
    a=list(map(int, input().split()))
    b=list(map(int, input().split()))
    grow = shrink = False
    for ai, bi in zip(a,b):
        if bi < ai:
            if not shrink:
                print('NO')
                break
        elif bi > ai and not grow:
            print('NO')
            break
        if ai == 1:
            grow = True
        elif ai == -1:
            shrink = True
    else:
        print('YES')


t = int(input())
for case_num in range(t):
    n = int(input())
    a = list(map(int, input().split(' ')))
    b = list(map(int, input().split(' ')))
    pos = False
    neg = False
    ok = True
    for i in range(n):
        if (not pos) and (not neg) and (a[i] != b[i]):
            ok = False
            break
        if (not pos) and (a[i] < b[i]):
            ok = False
            break
        if (not neg) and (a[i] > b[i]):
            ok = False
            break
        if a[i] < 0:
            neg = True
        if a[i] > 0:
            pos = True
    print('YES' if ok else 'NO')


import math


def main():
    was = set()
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    for i in range(n):
        if a[i] - b[i] > 0:
            if not -1 in was:
                print("NO")
                return
        elif a[i] - b[i] < 0:
            if not 1 in was:
                print("NO")
                return
        was.add(a[i])
    print("YES")

def __starting_point():
    t = int(input())
    for i in range(t):
        main()

__starting_point()

from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 300010
MOD = 10**9+7
spf = [i for i in range(MAXN)]
spf[0]=spf[1] = -1
def sieve():
    for i in range(2,MAXN,2):
        spf[i] = 2
    for i in range(3,int(MAXN**0.5)+1):
        if spf[i]==i:
            for j in range(i*i,MAXN,i):
                if spf[j]==j:
                    spf[j]=i
def fib(n,m):
    if n == 0:
        return [0, 1]
    else:
        a, b = fib(n // 2)
        c = ((a%m) * ((b%m) * 2 - (a%m)))%m
        d = ((a%m) * (a%m))%m + ((b)%m * (b)%m)%m
        if n % 2 == 0:
            return [c, d]
        else:
            return [d, c + d]

def charIN(x= ' '):
    return(sys.stdin.readline().strip().split(x))

def arrIN(x = ' '):
    return list(map(int,sys.stdin.readline().strip().split(x)))

def ncr(n,r):
    num=den=1
    for i in range(r):
        num = (num*(n-i))%MOD
        den = (den*(i+1))%MOD

    return (num*(pow(den,MOD-2,MOD)))%MOD

def flush():
    return sys.stdout.flush()

'''*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'''
def solve():
    n = int(input())
    a = arrIN()
    b = arrIN()
    x = [[0,0,0] for i in range(n)]
    for i in range(n):
        x[i][0] = int(a[i]==-1)
        x[i][1] = int(a[i]==0)
        x[i][2] = int(a[i]==1)
        x[i][0]|=x[i-1][0]
        x[i][1]|=x[i-1][1]
        x[i][2]|=x[i-1][2]
    if a[0]!=b[0]:
        print('NO')
    else:
        for i in range(1,n):
            if a[i]!=b[i]:
                if a[i]>b[i]:
                    if not x[i-1][0]:
                        print('NO')
                        break
                else:
                    if not x[i-1][2]:
                        print('NO')
                        break
        else:
            print('YES')


t = int(input())
for i in range(t):
    solve()