#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &V);
template <typename T>
ostream &operator<<(ostream &out, const set<T> &S);
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P);
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const map<T1, T2> &M);
void testcase() {
  int n;
  cin >> n;
  vector<int> V(n);
  for (int i = 0; i < n; i++) {
    cin >> V[i];
  }
  int acc = 0;
  for (int i = n - 2; i >= 0; i--) {
    if (V[i] > V[i + 1]) {
      acc += V[i] - V[i + 1];
    }
    if (acc > V[i]) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
void init() {}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  init();
  int T = 1;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    testcase();
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &V) {
  if (!V.empty()) {
    out << "{";
    for (auto v : V) out << v << ", ";
    out << "\b\b}";
  } else {
    out << "{}";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const set<T> &S) {
  if (!S.empty()) {
    out << "set{";
    for (auto v : S) out << v << ", ";
    out << "\b\b}";
  } else {
    out << "{}";
  }
  return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const map<T1, T2> &M) {
  if (!M.empty()) {
    out << "map{";
    for (auto &kv : M)
      out << "(" << kv.first << ": " << kv.second << ")"
          << ", ";
    out << "\b\b}";
  } else {
    out << "{}";
  }
  return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P) {
  out << "{" << P.first << ", " << P.second << "}";
  return out;
}
