#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
const long long INF = 9 * 1e18;
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> ar(n);
  for (long long i = 0; i < n; i++) cin >> ar[i];
  long long req = 0;
  for (int i = 1; i < n; i++) {
    ar[i] -= req;
    if (ar[i] < 0) {
      cout << "NO" << endl;
      return;
    }
    if (ar[i] > ar[i - 1]) {
      req += ar[i] - ar[i - 1];
      ar[i] = ar[i - 1];
    }
  }
  cout << "YES" << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long q = 1;
  cin >> q;
  while (q--) {
    solve();
  }
  return 0;
}
