#include <bits/stdc++.h>
using namespace std;
const int mxn = 30002;
int n;
int a[mxn], b[mxn];
void answer() {
  cin >> n;
  a[0] = a[n + 1] = b[0] = 0x3f3f3f3f;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = min(a[i], b[i - 1]);
  }
  b[n + 1] = 0;
  for (int i = n, x = a[n + 1]; i; i--) {
    x = min(x, a[i]);
    if (x + b[i] < a[i]) {
      cout << "NO" << '\n';
      return;
    }
    b[i] = max(b[i + 1], min(b[i - 1], a[i] - x));
    x = a[i] - b[i];
  }
  cout << "YES" << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) answer();
  return 0;
}
