#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n + 1, 0);
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long mx = 1e8;
  for (long long i = 1; i <= n; i++) {
    mx = min({mx, max(0LL, a[i] - a[i - 1])});
    a[i] -= mx;
  }
  cout << (is_sorted(a.begin(), a.end()) ? "YES" : "NO") << "\n";
}
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long test, tc = 0;
  cin >> test;
  while (test--) {
    solve();
  }
}
