#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int now = 0x3f3f3f3f;
    int r = 0;
    bool ok = 1;
    for (int i = 1; i <= n; i++) {
      int a;
      cin >> a;
      if (r > a) ok = 0;
      a -= r;
      if (a <= now)
        now = a;
      else
        r += (a - now);
    }
    if (ok)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
