#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
const long long mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int maxn = 3e4 + 10;
const int maxm = 100 + 10;
int a[maxn], b[maxn];
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  b[1] = a[1];
  for (int i = 1; i <= n; i++) b[i] = a[i] - a[i - 1];
  for (int i = 2; i <= n; i++) b[i] = min(b[i], 0);
  int tmp = b[1];
  for (int i = 2; i <= n; i++) {
    tmp += b[i];
    if (tmp < 0) {
      printf("NO\n");
      return;
    }
  }
  printf("YES\n");
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
}
