#include <bits/stdc++.h>
using namespace std;
long long a[30005];
int cnt = 0;
void solve() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long pre = 100000000000000;
  long long crt = 0;
  int flag = 1;
  for (int i = n; i >= 1; i--) {
    a[i] -= crt;
    if (a[i] < 0) {
      flag = 0;
      break;
    }
    if (a[i] < pre) {
      pre = a[i];
    } else {
      crt += a[i] - pre;
    }
  }
  if (flag) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cnt++;
    solve();
  }
}
