#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e4 + 5;
int n;
int a[MAXN];
int raste[MAXN];
int pada[MAXN];
void test() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  bool moguce = true;
  memset(raste, 0, sizeof(raste));
  memset(pada, 0, sizeof(pada));
  raste[0] = 0;
  pada[0] = a[0];
  int ostalo;
  for (int i = 1; i < n; i++) {
    ostalo = a[i];
    if (ostalo < raste[i - 1]) {
      moguce = false;
      break;
    }
    raste[i] = raste[i - 1];
    ostalo -= raste[i];
    pada[i] = min(pada[i - 1], ostalo);
    ostalo -= pada[i];
    if (ostalo) raste[i] += ostalo;
  }
  if (moguce)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    test();
  }
  return 0;
}
