#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    bool p = false;
    bool neg = false;
    long long a[n], b[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    for (long long j = 0; j < n; j++) cin >> b[j];
    int flag = 0;
    for (long long i = 0; i < n; i++) {
      if (b[i] > a[i] && p == false) {
        flag = 1;
        break;
      } else if (a[i] > b[i] && neg == false) {
        flag = 1;
        break;
      }
      if (a[i] > 0)
        p = true;
      else if (a[i] < 0)
        neg = true;
    }
    if (flag == 1)
      cout << "NO" << '\n';
    else
      cout << "YES" << '\n';
  }
  return 0;
}
