#include <bits/stdc++.h>
using namespace std;
template <class T>
using v2d = vector<vector<T> >;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxN = 1e5 + 1;
int n;
int a[maxN], b[maxN];
bool cal() {
  vector<pair<int, int> > vp;
  for (int i = 1; i <= (int)(n); ++i) {
    if (b[i] < a[i]) {
      return 0;
    }
    if (b[i] > a[i]) {
      vp.emplace_back(i, b[i] - a[i]);
    }
  }
  for (int i = 1; i <= (int)(vp.size() - 1); ++i) {
    if (vp[i].first - vp[i - 1].first > 1 || vp[i].second != vp[i - 1].second) {
      return 0;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    for (int i = 1; i <= (int)(n); ++i) {
      cin >> a[i];
    }
    for (int i = 1; i <= (int)(n); ++i) {
      cin >> b[i];
    }
    if (cal()) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
