#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ldb = long double;
using pii = pair<int, int>;
const ll INF = 4e18;
const ll mod = 998244353;
template <class T>
ostream &operator<<(ostream &out, vector<T> const &v) {
  out << "[";
  for (int i = 0; i < v.size(); i++) {
    if (i) out << ", ";
    out << v[i];
  }
  return out << "]";
}
template <class T1, class T2>
ostream &operator<<(ostream &out, pair<T1, T2> const &p) {
  return out << "(" << p.f << ", " << p.s << ")";
}
ll nxt() {
  ll x;
  cin >> x;
  return x;
}
ll mmod(ll x, ll y) {
  if (x >= 0)
    return x % y;
  else
    return (y - (-x) % y) % y;
}
ll powmod(ll a, ll n) {
  ll res = 1;
  a %= mod;
  assert(n >= 0);
  for (; n; n >>= 1) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
void solve() {
  ll n = nxt();
  vector<ll> a(n);
  generate((a).begin(), (a).end(), nxt);
  vector<ll> adj(n);
  vector<ll> suff_min(n + 1, 1e8);
  for (int i = 1; i < n; ++i) {
    adj[i] = a[i] - a[i - 1];
  }
  for (ll i = n - 1; i >= 0; --i) {
    suff_min[i] = min(suff_min[i + 1], a[i]);
  }
  int need = 0;
  for (int i = 0; i < n; ++i) {
    if (adj[i] > 0) need += adj[i];
    if (suff_min[i] - need < 0) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
