#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, past_difference = 0, present_difference;
  cin >> t;
  for (int i = 0; i < t; i++) {
    past_difference = 0;
    present_difference = 0;
    cin >> n;
    int a[n], b[n], counter = 0;
    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++) {
      present_difference = a[i] - b[i];
      if (present_difference > 0) {
        counter = 100001;
        break;
      } else if (past_difference != present_difference &&
                 present_difference != 0) {
        counter++;
      }
      past_difference = present_difference;
    }
    if (counter == 1 || counter == 0) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
