#include <bits/stdc++.h>
const bool debugging = 1;
const long long mod = 1e9 + 7;
using namespace std;
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  for (auto v : V) {
    os << v << " ";
  }
  return os << "";
}
template <class T>
ostream &operator<<(ostream &os, vector<vector<T>> V) {
  for (long long i = 0; i < V.size(); i++) {
    for (long long j = 0; j < V[i].size(); j++) {
      os << V[i][j] << " ";
    }
    os << "\n";
  }
  return os << "";
}
template <class T>
ostream &operator<<(ostream &os, set<T> S) {
  for (auto s : S) {
    os << s << " ";
  }
  return os << "";
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << P.first << " " << P.second;
}
template <class L, class R>
ostream &operator<<(ostream &os, map<L, R> M) {
  os << "\n";
  for (auto m : M) {
    os << m << "\n";
  }
  return os << "";
}
void solve() {
  long long N;
  cin >> N;
  vector<long long> elements(N);
  for (long long i = 0; i < N; i++) {
    cin >> elements[i];
  }
  vector<long long> max_val(N);
  long long contri_front = elements[0];
  long long contri_end = 0;
  long long index = N;
  bool single = 1;
  for (long long i = 0; i < N; i++) {
    if (contri_front >= elements[i] && single) {
      contri_front = elements[i];
      elements[i] = 0;
    } else {
      single = 0;
      long long need_from_end = elements[i] - contri_front;
      if (need_from_end > elements[N - 1]) {
        cout << "NO"
             << "\n";
        return;
      }
      if (need_from_end < contri_end) {
        contri_front = elements[i] - contri_end;
        if (contri_front < 0) {
          cout << "NO"
               << "\n";
          return;
        }
      } else {
        contri_end = need_from_end;
      }
    }
  }
  cout << "YES"
       << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long no_of_testcases;
  cin >> no_of_testcases;
  while (no_of_testcases-- > 0) {
    solve();
  }
  return 0;
}
