#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
template <typename T>
using mxpq = priority_queue<T>;
template <typename T>
using mnpq = priority_queue<T, vector<T>, greater<T>>;
const long long mod = 998244353;
const long long N = 1e6 + 6;
const long long maxN = 3e4 + 15;
const long long MAX_SIZE = 2e6 + 6;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
long long powerM(long long x, long long y, long long M = mod) {
  long long v = 1;
  x = x % M;
  while (y > 0) {
    if (y & 1) v = (v * x) % M;
    y = y >> 1;
    x = (x * x) % M;
  }
  return v;
}
long long power(long long x, long long y) {
  long long v = 1;
  while (y > 0) {
    if (y & 1) v = v * x;
    y = y >> 1;
    x = x * x;
  }
  return v;
}
void solve() {
  int n;
  cin >> n;
  int a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  int mini = a[0];
  int left = 0;
  for (int i = 1; i < n; ++i) {
    a[i] -= left;
    if (a[i] < 0) {
      cout << "NO\n";
      return;
    }
    if (a[i] > mini) {
      a[i] -= mini;
      left += a[i];
    } else {
      mini = a[i];
    }
  }
  cout << "YES\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int testcases = 1;
  cin >> testcases;
  for (int caseno = 1; caseno <= testcases; ++caseno) {
    solve();
  }
  return 0;
}
