#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(vector<T> &a);
template <class T>
void read(T &a) {
  cin >> a;
}
template <class A, class... B>
void read(A &a, B &...b) {
  read(a);
  read(b...);
}
template <class T>
void read(vector<T> &a) {
  for (auto &v : a) read(v);
}
void Debug() { cerr << "]" << endl; }
template <class H, class... T>
void Debug(H h, T... t) {
  cerr << h;
  if (sizeof...(t)) cerr << ", ";
  Debug(t...);
}
const int d4x[4] = {-1, 0, 1, 0};
const int d4y[4] = {0, 1, 0, -1};
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 7;
long long powmod(long long base, long long exp, const long long MOD) {
  long long ans = 1;
  while (exp) {
    if (exp & 1) ans = (ans * base) % MOD;
    base = (base * base) % MOD;
    exp >>= 1;
  }
  return ans;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long modInverse(long long n, const long long p) {
  return powmod(n, p - 2, p);
}
const int N = 3e4 + 100;
int a[N];
int n;
struct Node {
  int lzy;
  int val;
  Node() : lzy(0), val(0) {}
};
Node st[4 * N];
void app(int i, int x, int l, int r) {
  st[i].lzy += x;
  st[i].val += x;
}
void push(int i, int l, int r) {
  int mid = (l + r) / 2;
  app(2 * i, st[i].lzy, l, mid);
  app(2 * i + 1, st[i].lzy, mid + 1, r);
  st[i].lzy = 0;
}
void update(int l1, int r1, int x, int i = 1, int l2 = 0, int r2 = n - 1) {
  if (l2 > r1 || r2 < l1) return;
  if (l2 >= l1 && r2 <= r1) {
    app(i, x, l2, r2);
    return;
  }
  int mid = (l2 + r2) / 2;
  push(i, l2, r2);
  update(l1, r1, x, 2 * i, l2, mid);
  update(l1, r1, x, 2 * i + 1, mid + 1, r2);
  st[i].val = min(st[2 * i].val, st[2 * i + 1].val);
}
int get(int l1, int r1, int i = 1, int l2 = 0, int r2 = n - 1) {
  if (l2 > r1 || r2 < l1) return 1e9;
  if (l2 >= l1 && r2 <= r1) return st[i].val;
  int mid = (l2 + r2) / 2;
  push(i, l2, r2);
  return min(get(l1, r1, 2 * i, l2, mid), get(l1, r1, 2 * i + 1, mid + 1, r2));
}
void test_case() {
  cin >> n;
  for (int i = 0; i <= 4 * n; ++i) {
    st[i].lzy = 0;
    st[i].val = 0;
  }
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    update(i, i, a[i]);
  }
  int cur = 0;
  for (int i = 0; i + 1 < n; ++i) {
    a[i + 1] -= cur;
    if (a[i] >= a[i + 1]) {
    } else {
      int need = a[i + 1] - a[i];
      int mi = get(i + 1, n - 1);
      if (mi >= need) {
        update(i + 1, n - 1, -need);
        a[i + 1] = a[i];
        cur += need;
      } else {
        cout << "NO\n";
        return;
      }
    }
  }
  cout << "YES\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    test_case();
  }
  return 0;
}
