#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=2e5+10,inf=1e9;
const ll mod=998244353;
int n;
bool check(vector<ll> a){
    for(int i=0;i+1<a.size();i++){
        if(a[i]>a[i+1])return false;
        a[i+1]-=a[i];
        a[i]=0;
    }
    if(a.back()==0)return true;
    return false;
}
void solve(){
    scanf("%d",&n);
    vector<ll> a(n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    vector<ll> pre(n),suf(n);
    if(check(a)){
        puts("YES");
        return;
    }
    swap(a[1],a[0]);
    if(check(a)){
        puts("YES");
        return;
    }
    swap(a[1],a[0]);
    swap(a[n-2],a[n-1]);
    if(check(a)){
        puts("YES");
        return;
    }
    swap(a[n-2],a[n-1]);
    if(n==1&&a[0]){
        puts("NO");
        return;
    }
    vector<ll> b=a;
    pre[0]=b[0];
    for(int i=1;i<n;i++){
        if(pre[i-1]==-inf||b[i]<b[i-1])pre[i]=-inf;
        else{
            b[i]-=b[i-1];
            b[i-1]=0;
            pre[i]=b[i];
        }
    }
    b=a;
    suf[n-1]=b[n-1];
    for(int i=n-2;i>0;i--){
        if(suf[i+1]==-inf||b[i]<b[i+1])suf[i]=-inf;
        else{
            b[i]-=b[i+1];
            b[i+1]=0;
            suf[i]=b[i];
        }
    }
    for(int i=1;i+2<n;i++){
        vector<ll> c={pre[i-1],a[i],a[i+1],suf[i+2]};
        if(pre[i-1]==-inf||suf[i+2]==-inf)continue;
        swap(c[1],c[2]);
        if(check(c)){
            puts("YES");
            return;
        }
    }
    puts("NO");
}
int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        solve();
    }
    return 0;
}
