#include <bits/stdc++.h>
const int mod = 1e9 + 7;
const int N = 3e5 + 1;
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " ";
  err(++it, args...);
}
long long arr[N], brr[N];
long long n, m, k, q, a, b;
long long binpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * a;
    a = a * a;
    n /= 2;
  }
  return res;
}
void solve() {
  cin >> n;
  vector<long long> arr(n);
  vector<long long> v;
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long x = arr[0];
  arr[0] = 0;
  for (int k = 0; k + 1 < n; k++) {
    x = min(max(0LL, arr[k + 1] - arr[k]), x);
    arr[k + 1] -= x;
  }
  bool ok = true;
  for (int k = 0; k + 1 < n; k++) {
    if (arr[k + 1] - arr[k] < 0) ok = false;
  }
  n = v.size();
  for (int i = 0; i < n; i++)
    if (v[i] < 0) ok = false;
  if (ok)
    cout << "yes";
  else
    cout << "no";
  cout << "\n";
  cerr << "\n";
}
int main() {
  int t;
  t = 1;
  cin >> t;
  int a = 0;
  while (t--) {
    solve();
  }
  return 0;
}
