#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e4 + 10;
int a[maxn], b[maxn];
int main() {
  ios::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int n, fg = 0, mi = 0x3f3f3f3f, ma = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      ma = max(ma, a[i] - mi);
      if (a[i] - ma > mi || a[i] < ma) fg = 1;
      mi = a[i] - ma;
    }
    if (!fg)
      cout << "YES" << endl;
    else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
