#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &res) {
  bool flag = false;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (flag = true);
  for (res = ch - 48; isdigit(ch = getchar());
       res = (res << 1) + (res << 3) + ch - 48)
    ;
  flag && (res = -res);
}
template <typename T>
void write(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
int t, n;
int a[30005];
int main() {
  read(t);
  while (t--) {
    read(n);
    for (int i = 1; i <= n; i++) {
      read(a[i]);
    }
    int sta = a[1];
    a[1] = 0;
    int tag = 1;
    for (int i = 2; i <= n; i++) {
      if (a[i] >= a[i - 1]) {
        int tmp = min(a[i] - a[i - 1], sta);
        a[i] -= tmp;
        sta = tmp;
      } else {
        tag = 0;
        break;
      }
    }
    if (tag)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
