#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (auto& i : a) cin >> i;
    long long mn = 1e18, take = 0;
    bool ok = 1;
    for (int i = 0; i < n; ++i) {
      a[i] -= take;
      mn = min(mn, a[i]);
      take += max(0LL, a[i] - mn);
      ok &= (a[i] >= 0);
    }
    cout << (ok ? "YES" : "NO") << '\n';
  }
}
