#include <bits/stdc++.h>
using namespace std;
const int N = 30005;
long long a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    long long x, y;
    x = a[0], y = 0;
    bool nemoze = 0;
    for (int i = 1; i < n; i++) {
      if (a[i] > x + y) {
        y += a[i] - (x + y);
      }
      if (a[i] < x + y) {
        x -= x + y - a[i];
      }
      if (x < 0 || y > a[n - 1]) nemoze = 1;
    }
    if (nemoze)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
