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].
import io
import os

from math import inf

# https://raw.githubusercontent.com/cheran-senthil/PyRival/master/pyrival/data_structures/SegmentTree.py
class SegmentTree:
    def __init__(self, data, default=0, func=max):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size : _size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        """func of data[start, stop)"""
        start += self._size
        stop += self._size

        res_left = res_right = self._default
        while start < stop:
            if start & 1:
                res_left = self._func(res_left, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res_right = self._func(self.data[stop], res_right)
            start >>= 1
            stop >>= 1

        return self._func(res_left, res_right)

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)


class Node:
    def __init__(self, minEven, maxEven, minOdd, maxOdd, total, count):
        self.minEven = minEven
        self.maxEven = maxEven
        self.minOdd = minOdd
        self.maxOdd = maxOdd
        self.total = total
        self.count = count

    def __repr__(self):
        return str(
            (
                self.minEven,
                self.maxEven,
                self.minOdd,
                self.maxOdd,
                self.total,
                self.count,
            )
        )


segDefault = Node(inf, -inf, inf, -inf, 0, 0)


def segMap(x, i):
    if i % 2 == 1:
        x *= -1
    return Node(x, x, inf, -inf, float(x), 1)


def segCombine(l, r):
    if l.count == 0:
        return r
    if r.count == 0:
        return l
    if l.count % 2 == 0:
        minEven = min(l.minEven, l.total + r.minEven)
        maxEven = max(l.maxEven, l.total + r.maxEven)
        minOdd = min(l.minOdd, l.total + r.minOdd)
        maxOdd = max(l.maxOdd, l.total + r.maxOdd)
    else:
        minEven = min(l.minEven, l.total + r.minOdd)
        maxEven = max(l.maxEven, l.total + r.maxOdd)
        minOdd = min(l.minOdd, l.total + r.minEven)
        maxOdd = max(l.maxOdd, l.total + r.maxEven)
    total = l.total + r.total
    count = l.count + r.count
    return Node(minEven, maxEven, minOdd, maxOdd, total, count)


def solve(N, A):
    # Greedily fill leftmost
    # For example, if A = [a,b,c,d,e,f], then at each i (covering i+1 also) we need:
    #    a
    #   -a + b
    #    a - b + c
    #   -a + b - c + d
    #    a - b + c - d + e
    #   -a + b - c + d - e + f
    # The last position should be 0 and the rest should be nonnegative
    needed = []
    extra = 0
    for x in A:
        extra = x - extra
        needed.append(extra)
    if needed[-1] == 0 and min(needed) >= 0:
        return "YES"

    # Segment tree holds [a, -b, c, -d, e, -f]
    # Can query for min max prefix sums split by parity:
    #   a
    #   a - b + c
    #   a - b + c - d + e
    #
    #   a - b
    #   a - b + c - d
    #   a - b + c - d + e - f
    segTree = SegmentTree(
        [segMap(x, i) for i, x in enumerate(A)], segDefault, segCombine,
    )
    last = segTree.query(0, N).total

    for i in range(N - 1):
        # Fast path to skip early if last pos won't be turned into a zero
        if A[i] == A[i + 1]:
            continue
        if i % 2 == 0:
            if last - 2 * A[i] + 2 * A[i + 1] != 0:
                continue
        else:
            if last + 2 * A[i] - 2 * A[i + 1] != 0:
                continue

        # Swap
        old1, old2 = segTree[i], segTree[i + 1]
        segTree[i] = segMap(A[i + 1], i)
        segTree[i + 1] = segMap(A[i], i + 1)


        if False:
            A[i], A[i + 1] = A[i + 1], A[i]
            pref = [0]
            for j, x in enumerate(A):
                if j % 2 == 0:
                    pref.append(pref[-1] + x)
                else:
                    pref.append(pref[-1] - x)
            for j in range(N + 1):
                check = segTree.query(0, j)
                evens = pref[1 : j + 1 : 2]
                odds = pref[2 : j + 1 : 2]
                assert check.total == pref[j]
                assert check.minEven == min(evens, default=inf)
                assert check.maxEven == max(evens, default=-inf)
                assert check.minOdd == min(odds, default=inf)
                assert check.maxOdd == max(odds, default=-inf)
                assert check.count == j == len(evens) + len(odds)
            A[i], A[i + 1] = A[i + 1], A[i]

        res = segTree.query(0, N)
        assert res.total == 0
        if res.minEven >= 0 and -res.maxOdd >= 0:
            return "YES"

        # Undo
        segTree[i], segTree[i + 1] = old1, old2
    return "NO"


if __name__ == "__main__":
    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

    TC = int(input())
    for tc in range(1, TC + 1):
        (N,) = [int(x) for x in input().split()]
        A = [int(x) for x in input().split()]
        ans = solve(N, A)
        print(ans)
