#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e5 + 9;
int t;
int n, m;
int a[N];
int b[N];
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> t;
  while (t--) {
    cin >> n;
    map<int, int> cnt;
    for (int i = 1; i <= n; i++) cin >> a[i], cnt[a[i]]++;
    for (int i = 1; i <= n; i++) cin >> b[i];
    bool flag = true;
    for (int i = n; i >= 1 && flag; i--) {
      cnt[a[i]]--;
      if (b[i] > a[i] && cnt[1] == 0 || b[i] < a[i] && cnt[-1] == 0) {
        flag = false;
        break;
      }
    }
    cout << (flag ? "YES" : "NO") << endl;
  }
  return 0;
}
