#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e4 + 11;
int n, a[N];
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int decl = 1;
  int decr = n;
  while (decl + 1 <= n and a[decl + 1] <= a[decl]) decl++;
  while (decr - 1 >= 1 and a[decr - 1] <= a[decr]) decr--;
  if (decr <= decl + 1) {
    cout << "YES\n";
    return;
  }
  int nd = a[decl + 1] - a[decl];
  for (int i = decl + 2; i < decr; i++) {
    if (a[i] < nd) {
      cout << "NO\n";
      return;
    }
    nd += max(0, a[i] - a[i - 1]);
  }
  if (a[decr] < nd) {
    cout << "NO\n";
    return;
  }
  nd = a[decr - 1] - a[decr];
  for (int i = decr - 2; i > decl; i--) {
    if (a[i] < nd) {
      cout << "NO\n";
      return;
    }
    nd += max(0, a[i] - a[i + 1]);
  }
  if (a[decl] < nd) {
    cout << "NO\n";
    return;
  }
  cout << "YES\n";
}
int main() {
  ;
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  ;
  int tt = 1;
  cin >> tt;
  for (int i = 1; i <= tt; i++) {
    solve();
  }
  return 0;
}
