#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
int main() {
  int t;
  cin >> t;
  int a[MAXN], b[MAXN];
  while (t--) {
    int n;
    cin >> n;
    map<int, set<int>> cnts;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      cnts[a[i]].insert(i);
    }
    for (int i = 0; i < n; i++) cin >> b[i];
    int can = 1;
    for (int i = n - 1; i >= 0; i--) {
      cnts[a[i]].erase(i);
      int d = b[i] - a[i];
      if (d > 0) {
        if (cnts[1].size() == 0) can = 0;
      } else if (d < 0) {
        if (cnts[-1].size() == 0) can = 0;
      }
    }
    if (can)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
