During cleaning the coast, Alice found n piles of stones. The i-th pile has a_i stones.

Piles i and i + 1 are neighbouring for all 1 ≤ i ≤ n - 1. If pile i becomes empty, piles i - 1 and i + 1 doesn't become neighbouring.

Alice is too lazy to remove these stones, so she asked you to take this duty. She allowed you to do only the following operation: 

  * Select two neighboring piles and, if both of them are not empty, remove one stone from each of them. 



Alice understands that sometimes it's impossible to remove all stones with the given operation, so she allowed you to use the following superability: 

  * Before the start of cleaning, you can select two neighboring piles and swap them. 



Determine, if it is possible to remove all stones using the superability not more than once.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of test cases.

The first line of each test case contains the single integer n (2 ≤ n ≤ 2 ⋅ 10^5) — the number of piles.

The second line of each test case contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the number of stones in each pile.

It is guaranteed that the total sum of n over all test cases doesn't exceed 2 ⋅ 10^5.

Output

For each test case, print YES or NO — is it possible to remove all stones using the superability not more than once or not.

Example

Input


5
3
1 2 1
3
1 1 2
5
2 2 2 1 3
5
2100 1900 1600 3000 1600
2
2443 2445


Output


YES
YES
YES
YES
NO

Note

In the first test case, you can remove all stones without using a superability: [1, 2, 1] → [1, 1, 0] → [0, 0, 0].

In the second test case, you can apply superability to the second and the third piles and then act like in the first testcase.

In the third test case, you can apply superability to the fourth and the fifth piles, thus getting a = [2, 2, 2, 3, 1].

In the fourth test case, you can apply superability to the first and the second piles, thus getting a = [1900, 2100, 1600, 3000, 1600].
#include <bits/stdc++.h>

using namespace std;

#define int long long

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
// void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef Local_Debug
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
// g++ file_name.cpp -DLocal_Debug

#define pie 3.141592653589793238462643383279
#define M1 1000000007
#define M2 998244353
#define ll long long
#define pb push_back
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rsort(x) sort(x,greater<int> ())
#define endl "\n"
#define gcd __gcd
#define lcm(a,b) (a*b)/gcd(a,b)
#define deci(n) fixed << setprecision(n)
#define test() int test_case;cin >> test_case;while (test_case--)
#define sp " "
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define max4(a,b,c,d) max(a,max3(b,c,d))
#define min4(a,b,c,d) min(a,min3(b,c,d))
#define max5(a,b,c,d,e) max(max4(a,b,c,d),e)
#define min5(a,b,c,d,e) min(min4(a,b,c,d),e)


typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef vector<pi> vpi;
typedef map<int,int> mi;

int Power(int n, int x,int mod) {int ans = 1;while (x > 0) {if (x & 1) ans = (ans * n) % mod;
n = (n * n) % mod;x = x >> 1;}return ans;}

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 

bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 

int getSum(int n) 
{  
   int sum = 0; 
   while (n != 0) 
   { 
       sum = sum + n % 10; 
       n = n/10; 
   } 
   return sum; 
} 
int myceil(int n,int x)
{
    int y;
    if(n%x==0)
    {
        y=n/x;
        return y;
    }
    else
    {
        y=n/x+1;
        return y;
    }
    
}
int maxCountSameSUM(int arr[], int n) 
{ 
    // Create a map to store frequency 
    unordered_map<int, int> M; 
  
    // Store counts of sum of all pairs 
    // in the map 
    for (int i = 0; i < n - 1; i++) 
        for (int j = i + 1; j < n; j++) 
            M[(arr[i] + arr[j])]++; 
  
    int max_count = 0; 
  
    // Find maximum count 
    for (auto ele : M) 
        if (max_count < ele.second) 
            max_count = ele.second; 
  
    return max_count; 
}

int md=M1;
vi fact, inv;
 
void inverse(ll n)
{if(n>=inv.size()){ll size=inv.size();size=size==0? 1:size;
inv.resize(n + 1);inv[0] = 1;
for (ll i = size; i <= n; i++)inv[i] = Power(fact[i], md-2, md);}}
 
void factorial(ll n)
{if(n>=fact.size()){ll size=fact.size();size=size==0? 1:size;
fact.resize(n + 1);fact[0] = 1;for (ll i = size; i <= n; i++)
fact[i] = (fact[i - 1] * i) % md;
}}
 
ll ncr(ll n, ll r) { return (((fact[n] * inv[r]) % md) * inv[n - r]) % md; }
//********************THE END OF TEMPLATES*******************//
 
int check( vi a)
{
    int n= sz(a);
    for (int i = 0; i < n-1; i++)
    {
        if(a[i]>a[i+1])
            return 0;
        a[i+1]-=a[i];
        a[i]=0;
    }
    if(a.back()==0)
        return 1;
    return 0;
    
}

void run_testcase(){
    int n;
    cin>>n;
    vi a(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    if(n==2)
    {
        if(a[0]==a[1])
        {
            cout<<"YES"<<endl;
            return;
        }
        else
        {
            cout<<"NO"<<endl;
            return;
        }
        
    }
    if(check(a))
    {
        cout<<"YES"<<endl;
        return;
    }
    swap(a[0],a[1]);
    if(check(a))
    {
        cout<<"YES"<<endl;
        return;
    }
    swap(a[0],a[1]);
    swap(a[n-2],a[n-1]);
    if(check(a))
    {
        cout<<"YES"<<endl;
        return;
    }
    swap(a[n-2],a[n-1]);
    vi p(n),s(n);
    vi b=a;
    p[0]=b[0];
    for (int i = 1; i < n; i++)
    {
        if(p[i-1]==-1 || b[i-1]>b[i])
        {
            p[i]=-1;
        }
        else
        {
            b[i]-=b[i-1];
            b[i-1]=0;
            p[i]=b[i];
        }
        
    }
    b=a;
    s[n-1]=b[n-1];
    for (int i = n-2; i >=0; i--)
    {
        if(s[i+1]==-1 || b[i+1]>b[i])
        {
            s[i]=-1;
        }
        else
        {
            b[i]-=b[i+1];
            b[i+1]=0;
            s[i]=b[i];
        }
        
    }
    for (int i = 1; i < n-2; i++)
    {
        vi res ={p[i-1],a[i],a[i+1],s[i+2]};
        if(p[i-1]==-1 || s[i+2]==-1)
        {
            continue;
        }
        swap(res[1],res[2]);
        if(check(res))
        {
            cout<<"YES"<<endl;
            return;
        }
    }
    cout<<"NO"<<endl;
}

int32_t main()
{
    test()
    {
        run_testcase();
    }

    return 0;
}
