#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int ara[n + 2];
    for (int i = 0; i < n; i++) cin >> ara[i];
    int need = ara[0];
    for (int i = 0; i < n - 1; i++) {
      if (ara[i] > ara[i + 1]) {
        need -= (ara[i] - ara[i + 1]);
      }
      if (need < 0) break;
    }
    if (need >= 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
