#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int days[15] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int is_leapyear(int y) { return y % 400 == 0 || (y % 4 == 0 && y % 100 != 0); }
int dx[8] = {0, 0, 1, -1, -1, -1, 1, 1};
int dy[8] = {1, -1, 0, 0, -1, 1, -1, 1};
inline long long read() {
  long long x = 0, sign = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') sign = -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return sign * x;
}
inline void write(long long x) {
  char r[30];
  int t = 0;
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  do {
    r[t++] = x % 10 + '0';
    x /= 10;
  } while (x);
  while (t) putchar(r[--t]);
}
inline void writesp(long long x) {
  write(x);
  putchar(' ');
}
inline void writeln(long long x) {
  write(x);
  putchar('\n');
}
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
const int N = 200010;
long long a[N];
int main() {
  int T = read();
  while (T--) {
    int n = read();
    for (int i = 1; i <= n; i++) a[i] = read();
    int r = a[1], l = 0;
    int flag = 1;
    for (int i = 2; i <= n; i++) {
      long long now = l;
      if (now > a[i]) {
        flag = 0;
        break;
      }
      a[i] -= now;
      if (a[i] > r) {
        long long x = a[i] - r;
        l += x;
      } else {
        r = a[i];
      }
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
