考虑 $b_i = a_{i + 1} - a_i$,保证 $b_i$ 全部非负就可以满足题意。观察 $b_i$ 的变化规律,奇数位置的 $b_i$ 传递给其它奇数位置的 $b_j$,偶数位置也只能传递给偶数位置。同时,$b_2$ 与 $b_{n-2}$ 可以任意大。所以偶数位置经过分散 $b_2$ 之后可以全部非负。只需要考虑 $n-2$ 的奇偶性,如果 $n-2$ 是偶数,那么剩下的奇数位置的和不会有任何增量,如果奇数位置原来的和为非负,那么可以保证重分布之后所有的元素都为非负。

//  2023/11/19

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <functional>

using namespace std;

const int INF = 0x3f3f3f3f, MOD = 1e9 + 7;
const double eps = 1e-8;
const int dir[8][2] = {
{0, 1}, {0, -1},
{1, 0}, {-1, 0},
{1, 1}, {1, -1},
{-1, 1}, {-1, -1},
};

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<int, int> PII;

const ull Pr = 131;

#define LN ListNode
#define LNP ListNode*
#define TN TreeNode
#define TNP TreeNode*

#define For(i, a, b) for (int i = int(a); i < int(b); ++i)
#define Rof(i, a, b) for (int i = int(b) - 1; i >= int(a); --i)
#define For1(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define Rof1(i, a, b) for (int i = int(b); i >= int(a); --i)
#define ForE(i, j) for (int i = h[j]; i != -1; i = ne[i])

#define f1 first
#define f2 second
#define pb push_back
#define has(a, x) (a.find(x) != a.end())
#define nonempty(a) (!a.empty())
#define all(a) (a).begin(),(a).end()
#define SZ(a) int((a).size())

#ifdef DEBUG
#define debug1(x) cout << #x" = " << x << endl;
#define debug2(x,y) cout << #x" = " << x << " "#y" = " << y << endl;
#define debug3(x,y,z) cout << #x" = " << x << " "#y" = " << y << " "#z" = " << z << endl;
#else
#define debug1
#define debug2
#define debug3
#endif

#ifdef DEBUG

struct ListNode {
    int val;
    ListNode *next;
    ListNode() : val(0), next(nullptr) {}
    ListNode(int val) : val(val), next(nullptr) {}
    ListNode(int val, ListNode *next) : val(val), next(next) {}
};

struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};

#endif

const int N = 300010;
int n, t;
ll a[N], b[N];

int main(int argc, const char * argv[]) {
    #ifdef USE_INPUT_FILE
    freopen("input.txt", "r", stdin);
    #endif

    std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    cin >> t;
    while (t--) {
        cin >> n;
        For1(i, 1, n) {
            cin >> a[i];
        }
        
        if (n == 2) {
            if (a[1] <= a[2]) cout << "YES";
            else cout << "NO";
            cout << '\n';
            continue;
        }
        
        For1(i, 1, n - 1) {
            b[i] = a[i + 1] - a[i];
        }
        
        if (n % 2 == 0) {
            ll sum = 0;
            for (int i = 1; i < n; i += 2) {
                sum += b[i];
            }
            
            if (sum >= 0) {
                cout << "YES";
            } else {
                cout << "NO";
            }
            cout << "\n";
            continue;
        } else {
            cout << "YES\n";
        }
    }

    return 0;
}