#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, i, k, x, a;
  cin >> t;
  while (t--) {
    cin >> n;
    vector<int> v(n);
    for (i = 0; i < n; i++) cin >> v[i];
    int c = 0, d = 0;
    bool flag = 1;
    for (i = 0; i < n; i++) {
      cin >> k;
      int d1 = (k - v[i]);
      if (d1 < 0) flag = 0;
      if (d == d1) continue;
      if (d) {
        if (d1) flag = 0;
        d = 0;
      } else {
        if (c) flag = 0;
        d = d1;
        c++;
      }
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
