#include <bits/stdc++.h>
using namespace std;
const int N = 30010;
int t, n, a[N], b[N], yuan[N], maxn1[N], maxn2[N];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      b[i] = a[i];
      yuan[i] = a[i];
    }
    a[0] = 1000000;
    a[n + 1] = a[0];
    b[0] = 1000000;
    b[n + 1] = b[0];
    yuan[0] = yuan[n + 1] = 1000000;
    int ok = 1;
    int kk = -1e9;
    for (int i = 1; i <= n; i++) {
      b[i] = min(b[i - 1], b[i]);
      if (a[i] - b[i] < kk && kk != -1e9) {
        b[i] = a[i] - kk;
      }
      if (b[i] < 0) {
        ok = 0;
      }
      a[i] -= b[i];
      kk = max(a[i], kk);
    }
    for (int i = n; i >= 1; i--) {
      if (a[i] > a[i + 1]) {
        ok = 0;
      }
    }
    if (ok) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
}
