#include <bits/stdc++.h>
const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const long long linf = (long long)1e18 + 7;
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
using namespace std;
int n;
long long a[N], b[N];
void solve() {
  cin >> n;
  for (int i = (1); i <= (n); i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  long long x = 0;
  for (int i = (2); i <= (n); i++) {
    a[i] -= x;
    if (a[i] > a[i - 1]) {
      x += a[i] - a[i - 1];
      a[i] = a[i - 1];
    }
  }
  if (*min_element(a + 1, a + 1 + n) >= 0) {
    cout << "YES\n";
    return;
  }
  x = 0;
  for (int i = (1); i <= (n); i++) a[i] = b[i];
  for (int i = (n - 1); i >= (1); i--) {
    a[i] -= x;
    if (a[i] > a[i + 1]) {
      x += a[i] - a[i + 1];
      a[i] = a[i + 1];
    }
  }
  if (*min_element(a + 1, a + 1 + n) >= 0) {
    cout << "YES\n";
    return;
  }
  cout << "NO\n";
}
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  exit(0);
}
