#include <bits/stdc++.h>
using namespace std;
int n, a[30013];
int u[30013], d[30013];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    d[0] = (int)1e9;
    for (int i = 1; i <= n; i++) {
      d[i] = min(d[i - 1], a[i]);
      u[i] = a[i] - d[i];
    }
    int res = 1;
    for (int i = 1; i <= n; i++) {
      if (d[i] > d[i - 1]) {
        u[i] += d[i] - d[i - 1];
        d[i] = d[i - 1];
      }
      if (u[i] < u[i - 1]) {
        d[i] -= u[i - 1] - u[i];
        u[i] = u[i - 1];
      }
      if (d[i] < 0) {
        res = 0;
        break;
      }
    }
    if (res)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
