#include <bits/stdc++.h>
using namespace std;
template <class t>
inline void read(t &s) {
  s = 0;
  register int f = 1;
  register char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar();
  s *= f;
  return;
}
template <class t, class... A>
inline void read(t &x, A &...a) {
  read(x);
  read(a...);
}
template <class t>
inline void write(t x) {
  if (x < 0) putchar('-'), x = -x;
  int buf[21], top = 0;
  while (x) buf[++top] = x % 10, x /= 10;
  if (!top) buf[++top] = 0;
  while (top) putchar(buf[top--] ^ '0');
  return;
}
inline void setIn(string s) {
  freopen(s.c_str(), "r", stdin);
  return;
}
inline void setOut(string s) {
  freopen(s.c_str(), "w", stdout);
  return;
}
inline void setIO(string s = "") {
  setIn(s + ".in");
  setOut(s + ".out");
  return;
}
template <class t>
inline bool checkmin(t &x, t y) {
  if (x > y) {
    x = y;
    return 1;
  }
  return 0;
}
template <class t>
inline bool checkmax(t &x, t y) {
  if (x < y) {
    x = y;
    return 1;
  }
  return 0;
}
inline int lowbit(int x) { return x & (-x); }
int a[30050], n;
inline void work() {
  read(n);
  for (int i = 1; i <= n; ++i) read(a[i]);
  if (n <= 2) {
    puts("YES");
    return;
  }
  register int Mn = a[1];
  for (int i = 2; i <= n; ++i)
    if (Mn < a[i]) {
      a[i] -= Mn;
      for (int j = i + 1; j <= n; ++j) {
        checkmin(Mn, max(0, min(a[j], a[j] - a[j - 1])));
        a[j] -= Mn;
      }
      for (int j = n; j > i; --j)
        if (a[j] < a[j - 1]) {
          puts("NO");
          return;
        }
      puts("YES");
      return;
    } else
      Mn = a[i];
  puts("YES");
  return;
}
signed main(void) {
  int t;
  read(t);
  while (t--) work();
  return 0;
}
