#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &a) {
  T flag = 1;
  char ch;
  a = 0;
  while ((ch = getchar()) < '0' || ch > '9')
    if (ch == '-') flag = -1;
  a = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9') a = a * 10 + ch - '0';
  a *= flag;
}
int a[100005];
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, tem;
    cin >> n;
    for (int i = 1; i <= n; i++) read(a[i]);
    for (int i = 1; i <= n; i++) read(tem), a[i] -= tem;
    int l = 1, r = n;
    while (a[l] == 0 && l < n) l++;
    while (a[r] == 0 && r > 1) r--;
    bool ok = 1;
    for (; l <= r; l++) {
      if (a[l] != a[r] || a[l] > 0) ok = 0;
    }
    if (ok)
      puts("yes");
    else
      puts("no");
  }
  return 0;
}
