#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<string> res = {"YES", "NO"};
  bool ans = 0;
  long long must = 0, allowed = a[0];
  for (long long i = 1; i < n; i++) {
    a[i] -= must;
    if (a[i] < 0) {
      ans = 1;
      break;
    }
    if (a[i] <= allowed) {
      allowed = a[i];
    } else {
      must += a[i] - allowed;
    }
  }
  cout << res[ans] << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout.precision(30);
  long long t = 1;
  cin >> t;
  while (t--) solve();
}
