#include <bits/stdc++.h>
using namespace std;
bool solve(vector<int> a) {
  int n = a.size();
  int mn = a[0];
  for (int i = 1; i < n; i++) {
    if (a[i] < a[i - 1]) {
      mn -= a[i - 1] - a[i];
      if (mn < 0) return 0;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &i : a) cin >> i;
    if (solve(a)) {
      cout << "YES\n";
      continue;
    }
    reverse(a.begin(), a.end());
    if (solve(a))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
