#include <bits/stdc++.h>
using namespace std;
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int a[200010], b[200010], n, ans[200010], cnt = 0;
int solve() {
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++)
    if (a[i] > b[i]) {
      puts("NO");
      return 0;
    }
  for (int i = 1; i <= n; i++)
    if (a[i] < b[i]) ans[cnt++] = i;
  for (int i = 0; i < cnt - 1; i++)
    if (ans[i + 1] != ans[i] + 1) {
      puts("NO");
      return 0;
    }
  for (int i = 0; i < cnt - 1; i++)
    if (b[ans[i]] - a[ans[i]] != b[ans[i + 1]] - a[ans[i + 1]]) {
      puts("NO");
      return 0;
    }
  puts("YES");
  return 0;
}
int main() {
  int T;
  for (cin >> T; T--;) solve();
  return 0;
}
