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 java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;

public class Main {

    public static void main(String[] args) {

        Parser parser = new Parser();
        int t = parser.parseInt();
        for (int i = 1; i <= t; i++) {
            Problem problem = new Problem();
            problem.solve(i);
        }
    }
}

class Problem {
    private Parser parser = new Parser();

    public void solve() {
    }

    public void solve(int testNum) {
        int n = parser.parseInt();
        int[] a = new int[n + 1];
        for(int i = 1; i <= n; i++) {
            a[i] = parser.parseInt();
        }

        long[] prefix = new long[n + 2];
        for(int i = 1; i <= n; i++) {
            if(prefix[i - 1] > a[i] || prefix[i - 1] == -1) {
                prefix[i] = -1;
            } else {
                prefix[i] = a[i] - prefix[i - 1];
            }
        }

        if(prefix[n] == 0) {
            System.out.println("YES");
            return;
        }

        long[] suffix = new long[n + 2];
        for(int i = n; i >= 1; i--) {
            if(suffix[i + 1] > a[i] || suffix[i + 1] == -1) {
                suffix[i] = -1;
            } else {
                suffix[i] = a[i] - suffix[i + 1];
            }
        }

        for(int i = 2; i <= n; i++) {
            long[] arr = {0, prefix[i - 2], a[i], a[i - 1], suffix[i + 1]};
            boolean is = true;
            long prev = 0;
            for(int j = 0; j < 5; j++) {
                if(prev > arr[j] || arr[j] == -1) {
                    is = false;
                    break;
                }
                prev = arr[j] - prev;
            }
            if(is && prev == 0) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

class SegmentTree {
    private final int size;
    private final long[] data;
    private final long[] lazy;
    private final BiFunction<Long, Long, Long> updateFunction;

    public SegmentTree(long[] array, BiFunction<Long, Long, Long> updateFunction) {
        size = array.length;
        data = new long[size * 4];
        lazy = new long[size * 4];
        this.updateFunction = updateFunction;
        init(array, 1, 0, size - 1);
    }

    private long init(long[] array, int node, int start, int end) {
        if (start == end) {
            return data[node] = array[start];
        }
        int mid = (start + end) / 2;
        return data[node] = updateFunction.apply(init(array, node * 2, start, mid), init(array, node * 2 + 1, mid + 1, end));
    }

    public void updateRange(int l, int r, long diff) {
        updateRange(1, 0, size - 1, l, r, diff);
    }

    private void updateRange(int node, int start, int end, int l, int r, long diff) {
        propagation(node, start, end);
        if (isOutOfRange(start, end, l, r)) return;
        if (isAllIn(start, end, l, r)) {
            lazy[node] += diff;
            propagation(node, start, end);
            return;
        }

        int mid = (start + end) / 2;
        updateRange(node * 2, start, mid, l, r, diff);
        updateRange(node * 2 + 1, mid + 1, end, l, r, diff);
        data[node] = updateFunction.apply(data[node * 2], data[node * 2 + 1]);
    }

    public long get(int l, int r) {
        return get(1, 0, size - 1, l, r);
    }

    private long get(int node, int start, int end, int l, int r) {
        propagation(node, start, end);
        if (isOutOfRange(start, end, l, r)) return 0;
        if (isAllIn(start, end, l, r)) return data[node];
        int mid = (start + end) / 2;
        return updateFunction.apply(get(node * 2, start, mid, l, r), get(node * 2 + 1, mid + 1, end, l, r));
    }

    private void propagation(int node, int start, int end) {
        long v = lazy[node];
        data[node] = updateFunction.apply(data[node], (end - start + 1) * v);
        if (start != end) {
            lazy[node * 2] += v;
            lazy[node * 2 + 1] += v;
        }
        lazy[node] = 0;
    }

    private boolean isOutOfRange(int start, int end, int l, int r) {
        return l > end || r <= start;
    }

    private boolean isAllIn(int start, int end, int l, int r) {
        return l <= start && end < r;
    }
}

class MathUtil {

    public static List<Integer> getPrimes(int r) {
        if (r < 2) {
            return List.of();
        }

        List<Integer> result = new ArrayList<>();
        result.add(2);
        boolean[] is = new boolean[r + 1];
        for (int i = 4; i <= r; i += 2) {
            is[i] = true;
        }
        for (int i = 3; i <= r; i += 2) {
            if (is[i]) continue;
            result.add(i);
            for (long j = (long) i * i; j <= r; j += i) {
                is[(int) j] = true;
            }
        }
        return result;
    }

    public static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    public static long pow(long x, long y) {
        return pow(x, y, Function.identity());
    }

    public static long pow(long x, long y, long mod) {
        return pow(x, y, v -> v % mod);
    }

    private static long pow(long x, long y, Function<Long, Long> action) {
        long res = 1;
        long t = x;
        while (y > 0) {
            if ((y & 1) == 1) {
                res *= t;
                res = action.apply(res);
            }
            t *= t;
            t = action.apply(t);
            y /= 2;
        }
        return res;
    }
}

class DisjointSet {

    private final int[] f;
    private int size;

    public DisjointSet(int size) {
        this.size = size;
        f = new int[size];
        for (int i = 0; i < size; i++) {
            f[i] = i;
        }
    }

    public int find(int u) {
        if (f[u] == u) return u;
        return f[u] = find(f[u]);
    }

    public boolean merge(int u, int v) {
        u = find(u);
        v = find(v);
        if (u == v) return false;
        if (u > v) {
            int t = u;
            u = v;
            v = t;
        }
        f[u] = v;
        return true;
    }

    public int getGroupCounts() {
        Set<Integer> groups = new HashSet<>();
        for (int i = 0; i < size; i++) {
            groups.add(find(i));
        }
        return groups.size();
    }
}

class IntPair {
    private int l;
    private int r;

    public IntPair(int l, int r) {
        this.l = l;
        this.r = r;
    }

    public int getL() {
        return l;
    }

    public void setL(int l) {
        this.l = l;
    }

    public int getR() {
        return r;
    }

    public void setR(int r) {
        this.r = r;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        IntPair pair = (IntPair) o;
        return l == pair.l &&
                r == pair.r;
    }

    @Override
    public int hashCode() {
        return Objects.hash(l, r);
    }
}

class Parser {
    public static final Parser PARSER = new Parser();
    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private StringTokenizer tokenizer;

    public int parseInt() {
        fill();
        return Integer.parseInt(tokenizer.nextToken());
    }

    public long parseLong() {
        fill();
        return java.lang.Long.parseLong(tokenizer.nextToken());
    }

    public double parseDouble() {
        fill();
        return Double.parseDouble(tokenizer.nextToken());
    }

    public String parseLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    String parseString() {
        fill();
        return tokenizer.nextToken();
    }

    private void fill() {
        while (tokenizer == null || !tokenizer.hasMoreElements()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}