#include <bits/stdc++.h>
const int N = 3e5 + 5;
int T, n, i, x, d, v, o;
inline int mx(int x, int y) { return x > y ? x : y; }
inline int mn(int x, int y) { return x < y ? x : y; }
int main() {
  for (scanf("%d", &T); T--;) {
    d = 0, v = 1e9, o = 1;
    scanf("%d", &n);
    for (i = 1; i <= n; ++i) {
      scanf("%d", &x);
      if (!o) continue;
      x -= d;
      if (x < 0) {
        o = 0;
        continue;
      }
      d += mx(x - v, 0);
      v = mn(v, x);
    }
    if (o)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
