#include <bits/stdc++.h>
using namespace std;
void itval(istream_iterator<string> it) {}
template <typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  itval(++it, args...);
}
long long int MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {
  cout << x << "\n";
}
template <typename T>
inline void printvec(T x) {
  for (auto a : x) cout << a << ' ';
  cout << '\n';
}
struct custom {
  bool operator()(
      const pair<pair<long long int, long long int>, int> &p1,
      const pair<pair<long long int, long long int>, int> &p2) const {
    if (p1.first.first == p2.first.first) {
      if (p1.first.second == p2.first.second) return p1.second < p2.second;
      return p1.first.second > p2.first.second;
    }
    return p1.first.first < p2.first.first;
  }
};
long long int get_pow(long long int a, long long int b) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
const long long int N = 2e5 + 10, inf = 4e18;
void solve() {
  int n, dec = -1;
  cin >> n;
  vector<int> v(n);
  for (long long int i = (long long int)0; i < (long long int)(n); i++)
    cin >> v[i];
  for (long long int i = (long long int)1; i < (long long int)(n); i++) {
    if (v[i] > v[i - 1]) {
      dec = i - 1;
      break;
    }
  }
  if (dec == -1) {
    cout << "YES\n";
    return;
  }
  int can_do = v[dec], x = v[dec], last = -1;
  v[dec] = 0;
  for (long long int i = (long long int)dec + 1; i < (long long int)(n); i++) {
    int t = min(v[i] - v[i - 1], can_do);
    if (t < 0) {
      cout << "NO\n";
      return;
    }
    v[i] -= t;
    can_do = min(t, can_do);
  }
  cout << "YES\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  cin >> test;
  clock_t z = clock();
  for (long long int tes = (long long int)0; tes < (long long int)(test);
       tes++) {
    solve();
  }
  fprintf(stderr, "Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC),
      fflush(stderr);
  return 0;
}
