#include <bits/stdc++.h>
using namespace std;
int T, n, i, x;
int a[200010], b[200010], c[200010];
inline int Abs(int x) { return (x < 0) ? -x : x; }
inline void Swap(int &a, int &b) { a ^= b ^= a ^= b; }
inline int Min(int a, int b) { return (a < b) ? a : b; }
inline int Max(int a, int b) { return (a > b) ? a : b; }
inline int read() {
  int p = 0, f = 1;
  char c = getchar();
  while (c < 48 || c > 57) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= 48 && c <= 57) p = (p << 1) + (p << 3) + c - 48, c = getchar();
  return p * f;
}
int main() {
  T = read();
  while (T--) {
    n = read();
    for (i = 1; i <= n; i++) a[i] = read(), b[i] = c[i] = 0;
    if (n <= 2) {
      puts("YES");
      continue;
    }
    b[1] = a[1];
    c[1] = 0;
    for (i = 2; i <= n; i++) {
      b[i] = Min(b[i - 1], a[i] - c[i - 1]);
      c[i] = a[i] - b[i];
      if (b[i] < 0 || c[i] < 0) {
        puts("NO");
        goto END;
      }
    }
    puts("YES");
  END:;
  }
  return 0;
}
