#include <bits/stdc++.h>
using namespace std;
long long int inf = (1e18 + 2);
vector<long long int> getUniqs(vector<long long int> vec) {
  sort((vec).begin(), (vec).end());
  auto itr = unique((vec).begin(), (vec).end());
  vec.resize(distance(vec.begin(), itr));
  return vec;
}
long long int ceill(long long int N, long long int K) {
  long long int res = N / K;
  long long int rem = N % K;
  if (rem != 0) res++;
  return res;
}
long long int modExp(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int tstt;
  cin >> tstt;
  for (long long int qq = 0; qq < tstt; qq++) {
    long long int n;
    cin >> n;
    long long int a[n + 1];
    long long int flag = 1;
    long long int op1[n + 1];
    long long int op2[n + 1];
    vector<long long int> o1;
    vector<long long int> o2;
    long long int val;
    for (long long int i = 0; i < n; i++) cin >> a[i];
    for (long long int i = 0; i < n; i++) {
      if (i == 0) {
        op1[i] = a[i];
        op2[i] = 0ll;
        o1.push_back(a[i]);
        o2.push_back(0ll);
        continue;
      }
      val = max(a[i] - op1[i - 1], op2[i - 1]);
      if ((a[i] - val) <= op1[i - 1]) {
        op2[i] = val;
        op1[i] = a[i] - val;
      } else {
        op1[i] = op1[i - 1];
        op2[i] = a[i] - op1[i - 1];
      }
      o1.push_back(op1[i]);
      o2.push_back(op2[i]);
    }
    sort((o1).rbegin(), (o1).rend());
    sort((o2).begin(), (o2).end());
    for (long long int i = 0; i < n; i++) {
      if (op1[i] < 0 || op2[i] < 0) flag = 0;
    }
    if (flag == 1) {
      for (long long int i = 0; i < n; i++) {
        if (op1[i] != o1[i] || op2[i] != o2[i]) flag = 0;
      }
    }
    if (flag == 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
