#include <bits/stdc++.h>
using namespace std;
long long n, inf = 1e18;
void solve() {
  cin >> n;
  long long mi = 1e9, in = -1, a[n + 1], an = 0, c1 = 0, c2 = 0;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  for (long long i = 1; i <= n; ++i) {
    mi = min(mi, a[i]);
    if (mi == a[i]) in = i;
  }
  for (long long i = in; i >= 2; --i) {
    if (a[i] > a[i - 1]) {
      c2 += a[i] - a[i - 1];
      a[i] = a[i - 1];
    }
  }
  for (long long i = in; i <= n; ++i) a[i] -= c2;
  for (long long i = in; i < n; ++i) {
    if (a[i] > a[i + 1]) {
      c1 += a[i] - a[i + 1];
      a[i] = a[i + 1];
    }
  }
  for (long long i = 1; i <= in; ++i) a[i] -= c1;
  for (long long i = 1; i <= n; ++i) {
    if (a[i] < 0) {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES" << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
