#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
long long Bpow(long long a, long long s) {
  if (s == 0) {
    return 1;
  }
  long long u = Bpow(a, s / 2);
  if (s & 1)
    return u * u % mod * a % mod;
  else
    return u * u % mod;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    int ukr = n - 1;
    vector<int> suf(n);
    suf[n - 1] = a[n - 1];
    bool f = false;
    for (int i = n - 2; i >= 0; i--) {
      suf[i] = min(suf[i + 1], a[i]);
      if (a[i] <= a[i + 1] && !f)
        --ukr;
      else
        f = true;
    }
    int ukl = 0;
    int now = 0;
    for (int i = 0; i < n - 1; i++) {
      if (a[i] < a[i + 1]) {
        if (suf[i + 1] >= now + a[i + 1] - a[i]) {
          now += a[i + 1] - a[i];
        } else
          break;
      }
      ++ukl;
    }
    if (ukr - ukl > 1)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
