#include <bits/stdc++.h>
using namespace std;
int a[30002];
int c[30002], d[30002];
int main() {
  int t, i, n;
  cin >> t;
  for (; t; t--) {
    cin >> n;
    for (i = 1; i <= n; i++) cin >> a[i];
    d[1] = a[1];
    for (i = 2; i <= n; i++) {
      d[i] = min(d[i - 1], a[i] - c[i - 1]);
      if (d[i] < 0) break;
      c[i] = a[i] - d[i];
    }
    if (i <= n)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
