#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int &i : a) cin >> i;
    vector<long long> g(n), h(n);
    for (int i = 1; i < n; i++) {
      if (a[i] - a[i - 1] >= 0) {
        g[i] = a[i] - a[i - 1];
      } else {
        h[i] = a[i] - a[i - 1];
      }
    }
    g[0] += a[0];
    for (int i = 1; i < n; i++) {
      g[i] += g[i - 1];
      h[i] += h[i - 1];
    }
    long long delta = -h.back();
    for (long long &x : g) x -= delta;
    for (long long &y : h) y += delta;
    bool ok = true;
    for (int i = 0; i < n; i++) {
      ok &= g[i] >= 0;
      ok &= h[i] >= 0;
    }
    if (ok)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
  exit(0);
}
