#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long INF = 1e18 + 5;
const long long maxn = 5e5 + 5;
long long n = 100000000000, a[1555555], d[1055555][2], mx = -1000000001;
long long u[1511111], b[1100005], sum, cnt, r[555555];
map<long long, long long> num;
long long bi(long long x, long long y) {
  if (y == 0) return 1ll;
  if (y == 1) return x;
  long long z = bi(x, y / 2);
  z = z * z % n;
  if (y & 1) z = z * x % n;
  return z % n;
}
vector<int> g[555555], vv;
long long ti, tin[555555], fup[555555], x[555555], y[555555], dp[301][55555];
long long l[555555];
int c[555555];
vector<int> v[555];
int t[555555];
void upd(long long l, long long r) {
  for (long long i = l; i <= 200000; i |= (i + 1)) t[i] += r;
}
long long ge(long long pos) {
  long long res = 0;
  for (long long i = pos; i >= 1; i = (i & (i + 1)) - 1) res += t[i];
  return res;
}
pair<int, pair<int, int> > p[555555];
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    long long mn = 1e9;
    mn = 0;
    for (int i = n - 1; i >= 1; i--) {
      int x = a[i];
      a[i] = min(a[i + 1], a[i] - mn);
      mn = max(mn, x - a[i]);
    }
    mn = 0;
    for (int i = 2; i <= n; i++) {
      int x = a[i];
      a[i] = min(a[i - 1], a[i] - mn);
      mn = max(mn, x - a[i]);
    }
    int ok = 1;
    for (int i = 1; i < n; i++)
      if (a[i] != a[i + 1] || a[i] < 0) ok = 0;
    if (a[n] < 0) ok = 0;
    if (ok == 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
