#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C& a, C b) {
  a = min(a, b);
}
template <class C>
void maxi(C& a, C b) {
  a = max(a, b);
}
void a() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long bajo = 0;
  for (int(i) = n - 1 - 1; i >= 0; i--) {
    if (a[i] > a[i + 1]) bajo += a[i] - a[i + 1];
    if (bajo > a[i]) {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) a();
  return 0;
}
