#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  std::vector<long long> A(n);
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
  }
  long long dec = 0;
  for (long long i = 1; i < n; i++) {
    if (A[i] < dec) {
      cout << "NO" << endl;
      return;
    }
    if (A[i - 1] < A[i]) {
      dec += (A[i] - A[i - 1]);
    }
  }
  cout << "YES" << endl;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
