#include <bits/stdc++.h>
using namespace std;
long i, j, k;
void solve() {
  long n;
  cin >> n;
  long a[n], x[n], y[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  x[0] = a[0];
  y[0] = 0;
  for (i = 1; i < n; i++) {
    x[i] = min(x[i - 1], a[i] - y[i - 1]);
    y[i] = a[i] - x[i];
    if (x[i] < 0 || y[i] < 0) {
      cout << "NO"
           << "\n";
      return;
    }
  }
  cout << "YES"
       << "\n";
}
int main() {
  int T;
  cin >> T;
  while (T > 0) {
    T--;
    solve();
  }
  return 0;
}
