#include <bits/stdc++.h>
using namespace std;
int cnt_test;
int n;
int a[30001];
template <typename T>
inline T read() {
  T x = 0;
  T multiplier = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') {
      multiplier = -1;
    }
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch & 15);
    ch = getchar();
  }
  return x * multiplier;
}
int main() {
  cnt_test = read<int>();
  while (cnt_test--) {
    n = read<int>();
    for (int i = 1; i <= n; i++) {
      a[i] = read<int>();
    }
    int x = a[1], y = 0;
    for (int i = 2; i <= n; i++) {
      if (a[i] < a[i - 1]) {
        x -= a[i - 1] - a[i];
      } else {
        y += a[i] - a[i - 1];
      }
      if (x < 0 || y < 0) {
        puts("NO");
        goto next_in_loop;
      }
    }
    puts("YES");
  next_in_loop:;
  }
}
