#include <bits/stdc++.h>
using namespace std;
int t, n;
int a[100100];
int b[100100];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
      cin >> b[i];
    }
    int blocks = 0;
    for (int i = 0; i < n; i++) {
      int d = b[i] - a[i];
      int j = i;
      if (d == 0) continue;
      if (d < 0) blocks = 100;
      blocks++;
      while (j < n && (b[j] - a[j] == d)) {
        j++;
      }
      i = j - 1;
    }
    if (blocks <= 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
