#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void solve() {
  int i, j;
  int n;
  cin >> n;
  int arr[n];
  for (i = 0; i < n; i++) cin >> arr[i];
  int minm = arr[0], rem = 0;
  for (i = 1; i < n; i++) {
    if (arr[i] < rem) {
      break;
    }
    if (arr[i] >= (minm + rem))
      rem = arr[i] - minm;
    else
      minm = arr[i] - rem;
  }
  if (i == n)
    cout << "YES";
  else
    cout << "NO";
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
