#include <bits/stdc++.h>
using namespace std;
const long long sz = 3e4 + 10;
long long ara[sz];
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    scanf("%lld", &n);
    for (long long i = 1; i <= n; ++i) scanf("%lld", &ara[i]);
    if (n <= 2) {
      printf("YES\n");
      continue;
    }
    long long pre = ara[1], suf = 0, ok = 1;
    for (long long i = 2; i < n; i++) {
      pre = min(pre, ara[i]);
      long long need = ara[i] - pre;
      if (need > ara[n]) {
        ok = 0;
        break;
      }
      if (need >= suf) {
        suf = max(suf, need);
        continue;
      }
      long long dec = suf - need;
      pre -= dec;
      if (pre < 0) {
        ok = 0;
        break;
      }
    }
    if (ok)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
