#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 7;
const long long mod = 998244353;
long long a[N], cnt[N];
void solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    cnt[i] = 0;
  }
  for (long long i = 2; i <= n; i++) {
    if (a[i] < a[i - 1]) {
      cnt[1] += a[i - 1] - a[i];
      cnt[i] -= a[i - 1] - a[i];
    }
  }
  for (long long i = 1; i <= n; i++) {
    cnt[i] += cnt[i - 1];
    a[i] -= cnt[i];
  }
  for (long long i = 1; i <= n; i++) {
    if (a[i] < a[i - 1] || a[i] < 0) {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
}
