#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
inline void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int& e : a) {
    cin >> e;
  }
  long long b = a[0];
  for (int i = 0; i < n - 1; ++i) {
    int d = a[i + 1] - a[i];
    if (d < 0) {
      b += d;
      if (b < 0) {
        cout << "NO\n";
        return;
      }
    }
  }
  cout << "YES\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  size_t t = 1;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    solve();
  }
}
