#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace std;
long long max(long long x, long long y) {
  if (x > y)
    return x;
  else
    return y;
}
long long min(long long x, long long y) {
  if (x > y)
    return y;
  else
    return x;
}
vector<long long> fac(500001);
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long n, long long p) { return power(n, p - 2, p); }
long long ncr(long long n, long long r) {
  long long p = 998244353;
  if (r == 0) return 1;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
bool isprime(long long n) {
  if (n == 1) return false;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i, j, k, n, ans, t, m;
  cin >> t;
  while (t--) {
    cin >> n;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) cin >> a[i];
    k = 0;
    i = n - 1;
    while ((i > 0) && (a[i] >= a[i - 1])) i--;
    if ((i == 0) || (n == 1)) {
      cout << "YES"
           << "\n";
      continue;
    }
    i--;
    while (i >= 0) {
      if ((a[i] - k) > a[i + 1]) {
        j = a[i] - k - a[i + 1];
        k += j;
        a[i] = a[i + 1];
      } else {
        if ((a[i] - k) < 0) {
          cout << "NO"
               << "\n";
          goto lab;
        }
        a[i] = a[i] - k;
      }
      i--;
    }
    cout << "YES"
         << "\n";
  lab:;
  }
  return 0;
}
