#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1000000007;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = (0); i < (long long)(n); i++) cin >> a[i];
  auto b = a;
  long long mx = a[0], rmx = 0;
  for (long long i = (0); i < (long long)(n); i++) {
    mx = min({mx, a[i], a[i] - rmx});
    b[i] -= mx;
    rmx = max(rmx, b[i]);
  }
  bool f = true;
  for (long long i = (0); i < (long long)(n); i++)
    if (b[i] > a[n - 1]) f = false;
  if (f)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}
