#include <bits/stdc++.h>
using namespace std;
const int sqr = 500;
long long P = 1e9 + 7;
const int arrn = 2e5 + 3;
const int arrn2 = 5e3 + 3;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) b[i] -= a[i];
  for (int i = n - 1; i >= 1; i--) b[i] -= b[i - 1];
  int cnt = 0;
  int tot = 0;
  for (int i = 0; i < n; i++) {
    tot += b[i];
    if (cnt == 0 && b[i] < 0) {
      cout << "NO\n";
      return;
    }
    if (b[i] != 0) cnt++;
  }
  if ((cnt == 2 && tot == 0) || (cnt <= 1))
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
