#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
const int maxn = 5e5 + 555;
int saveori[maxn];
int nor[maxn];
int nol[maxn];
int tor[maxn];
int tol[maxn];
int n;

void solve() {
    cin >> n;
    nor[n + 1] = 0;
    nol[n + 1] = 0;

    for (int i = 1; i <= n; i++) {
        scanf("%lld", &saveori[i]);
    }
    
    int last = 0;
    for (int i = 1; i <= n; i++) {
        tor[i] = saveori[i] - last;
        last = tor[i];
        //tor这个值已经是假的了
        if (tor[i] < 0) {
            nor[i] = 1;
        }
        else {
            nor[i] = nor[i - 1];
        }
    }
    if (last == 0 && nor[n] == 0) {
        puts("YES");
        return;
    }

    last = 0;
    for (int i = n; i >= 1; i--) {
        tol[i] = saveori[i] - last;
        last = tol[i];
        if (tol[i] < 0) {
            nol[i] = 1;
        }
        else {
            nol[i] = nol[i + 1];
        }
    }
    

    for (int i = 1; i < n; i++) {
        if (nor[i - 1] || nol[i + 2]) {
            continue;
        }
        int lval = saveori[i + 1];
        int rval = saveori[i];
        lval -= tor[i - 1];
        rval -= tol[i + 2];
        if (lval == rval && lval >= 0) {
            puts("YES");
            return;
        }
    }
    puts("NO");
}

signed main() {
   // freopen("in.txt", "r", stdin);
    int T;
    cin >> T;
    while (T--) {
        solve();
    }
}