#include <bits/stdc++.h>
using namespace std;
int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -f;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return f * x;
}
inline int lowbit(int x) { return x & (-x); }
inline int modadd(int x, int y) {
  return (x + y >= 1000000007 ? x + y - 1000000007 : x + y);
}
inline int sgn(int x) { return (x < 0 ? -1 : (x > 0 ? 1 : 0)); }
template <typename T>
T gcd(T a, T b) {
  return (!b) ? a : gcd(b, a % b);
}
int poww(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = 1ll * res * a % 1000000007;
    a = 1ll * a * a % 1000000007, b >>= 1;
  }
  return res;
}
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
const int ddx[] = {-1, -1, -1, 0, 0, 1, 1, 1},
          ddy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int n, a[100005];
void init() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
}
bool check1() {
  long long tot = 0;
  for (int i = n - 1; i >= 1; --i) {
    if (a[i] < tot) return false;
    if (a[i] > a[i + 1]) tot += a[i] - a[i + 1];
  }
  return true;
}
bool check2() {
  long long tot = 0;
  for (int i = 2; i <= n; ++i) {
    if (a[i] < tot) return false;
    if (a[i] > a[i - 1]) tot += a[i] - a[i - 1];
  }
  return true;
}
void solve() {
  if (check1())
    printf("YES\n");
  else if (check2())
    printf("YES\n");
  else
    printf("NO\n");
}
int main() {
  int T = read();
  while (T--) {
    init();
    solve();
  }
  return 0;
}
