#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double pi = acos(-1.0);
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tt;
  cin >> tt;
  while (tt--) {
    long long n;
    cin >> n;
    long long a[n + 1];
    long long b[n + 1];
    for (long long i = 0; i < n; i += 1) {
      cin >> a[i];
      b[i] = a[i];
    }
    bool check = true;
    long long dec = 0;
    for (long long i = n - 2; i >= 0; i--) {
      if (a[i] - dec <= a[i + 1]) {
        a[i] = a[i] - dec;
      } else {
        long long dif = a[i] - dec - a[i + 1];
        dec += dif;
        a[i] = a[i + 1];
      }
      if (a[i] < 0) {
        check = false;
      }
    }
    dec = 0;
    for (long long i = 1; i < n; i++) {
      if (a[i] - dec <= a[i - 1]) {
        a[i] = a[i] - dec;
      } else {
        long long dif = a[i] - dec - a[i - 1];
        dec += dif;
        a[i] = a[i - 1];
      }
      if (a[i] < 0) {
        check = false;
      }
    }
    if (check)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
