#include <bits/stdc++.h>
using namespace std;
int ar[30005];
int diff[30005];
int main() {
  int t;
  cin >> t;
  while (t--) {
    string ans = "YES";
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> ar[i];
      diff[i] = 0;
    }
    for (int i = 2; i <= n; i++) {
      if (ar[i] < ar[i - 1]) {
        diff[1] += ar[i - 1] - ar[i];
        diff[i] -= ar[i - 1] - ar[i];
      }
    }
    for (int i = 1; i <= n; i++) {
      diff[i] += diff[i - 1];
      ar[i] -= diff[i];
      if (ar[i] < 0 || (i > 1 && ar[i] < ar[i - 1])) {
        ans = "NO";
      }
    }
    cout << ans << endl;
  }
  return 0;
}
