#include <bits/stdc++.h>
using namespace std;
bool f(int n, vector<int>& a) {
  vector<int> cnt(3, 0);
  int ans = 1;
  for (int i = 1; i <= n; i++) {
    int b;
    scanf("%d", &b);
    if (b > a[i] && cnt[2] == 0)
      ans = 0;
    else if (b < a[i] && cnt[0] == 0)
      ans = 0;
    cnt[a[i] + 1]++;
  }
  return ans;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    vector<int> a(100002, 0);
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    if (f(n, a))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
