#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
int nn = 2e5 + 7;
set<int> pri;
void solve() {
  int n;
  cin >> n;
  vector<int> arr(n), decl(n), decr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int mi = INF;
  for (int i = 0; i < n; i++) {
    mi = min(mi, arr[i]);
    decl[i] = mi;
  }
  mi = INF;
  for (int i = n - 1; i > -1; i--) {
    mi = min(mi, arr[i]);
    decr[i] = mi;
  }
  int k = 1;
  int mk = 0;
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      decl[i] = min(decl[i], decl[i - 1]);
    }
    if (arr[i] - decl[i] > 0) {
      mk = max(mk, arr[i] - decl[i]);
    }
    if (decl[i] + mk < arr[i]) {
      k = 0;
    }
    decl[i] = arr[i] - mk;
    if (decl[i] < 0) {
      k = 0;
    }
  }
  if (k) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int testcase = 1;
  cin >> testcase;
  for (int i = 0; i < testcase; i++) {
    solve();
  }
  return 0;
}
