#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 2e6 + 7;
const int M = 3e4 + 7;
int n, a[M];
void solve() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  int lo = 1, hi = n;
  while (lo < n && a[lo + 1] <= a[lo]) ++lo;
  while (hi > 1 && a[hi - 1] <= a[hi]) --hi;
  if (lo >= n - 1 || hi <= 2 || lo >= hi) {
    cout << "YES\n";
    return;
  }
  int p = lo, cnt = 0, mx = a[lo], mxp = lo;
  for (int i = lo + 1; i < hi; ++i) {
    if (a[i] < a[i - 1] && a[i] < a[i + 1]) {
      p = i;
      cnt++;
    }
    if (a[i] > mx) {
      mx = a[i];
      mxp = i;
    }
  }
  if (1 < cnt) {
    cout << "NO\n";
    return;
  }
  if (0 == cnt) {
    if (mx <= a[lo] + a[hi])
      cout << "YES\n";
    else
      cout << "NO\n";
    return;
  }
  int mxl = 0, mxr = 0;
  for (int i = lo + 1; i < p; ++i) mxl = max(mxl, a[i]);
  for (int i = p + 1; i < hi; ++i) mxr = max(mxr, a[i]);
  int dl = a[lo] - (mxl - a[p]);
  int dr = a[hi] - (mxr - a[p]);
  if (a[p] <= dl + dr)
    cout << "YES\n";
  else
    cout << "NO\n";
}
void solve2() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  int u = a[1], v = 0;
  for (int i = 2; i <= n; ++i) {
    u = min(u, a[i] - v);
    if (u < 0 || a[i] - u < v) {
      cout << "NO\n";
      return;
    }
    v = a[i] - u;
  }
  cout << "YES\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve2();
    fflush(stdout);
  }
  return 0;
}
