#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int test = 0; test < t; test++) {
    bool answer = true;
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    unordered_map<int, int> keys_to_counts;
    keys_to_counts[1] = 0;
    keys_to_counts[-1] = 0;
    keys_to_counts[0] = 0;
    for (int x : a) {
      keys_to_counts[x]++;
    }
    keys_to_counts[a[n - 1]]--;
    for (int i = n - 1; i >= 0; i--) {
      if (b[i] > a[i]) {
        answer &= (keys_to_counts[1] > 0);
      } else if (b[i] < a[i]) {
        answer &= (keys_to_counts[-1] > 0);
      }
      if (i != 0) keys_to_counts[a[i - 1]]--;
    }
    if (answer)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
