#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> v(n), a(n), b(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
  a[0] = v[0];
  for (long long int i = 1; i < n; i++) {
    a[i] = min(a[i - 1], v[i] - b[i - 1]);
    b[i] = v[i] - a[i];
    if ((a[i] > v[i]) || (b[i] < b[i - 1]) || (0 > a[i])) {
      cout << "NO"
           << "\n";
      return;
    }
  }
  cout << "YES"
       << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
