#include <bits/stdc++.h>
using namespace std;
const int N = 3E4 + 7;
int x[N], y[N];
void solve() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  x[0] = a[0], y[0] = 0;
  for (int i = 1; i < n; i++) {
    x[i] = min(x[i - 1], a[i]), y[i] = a[i] - x[i];
    if (y[i] >= y[i - 1]) continue;
    y[i] = y[i - 1], x[i] = a[i] - y[i];
    if (x[i] < 0) {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
