#include <bits/stdc++.h>
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const int MAX_N = 5e5 + 7;
using namespace std;
int a[MAX_N];
int main() {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    int N;
    cin >> N;
    for (int i = 1; i <= N; i++) cin >> a[i];
    bool ans = true;
    int lim = inf;
    for (int i = 1; i <= N; i++) {
      int t = a[i] - a[i - 1];
      if (t < 0) ans = false;
      lim = min(lim, t);
      a[i] -= lim;
    }
    if (ans)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
