#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, M = 1e6, P = 1e9 + 7, INF = 0X3F3F3F3F;
const unsigned long long D = 743, mo = 966335533, mo1 = 966331133;
long long n, a[N], pre[N], suf[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    int fg = 1;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    fill(pre, pre + 1 + n + 5, 1e18);
    fill(suf, suf + 1 + n + 5, 1e18);
    pre[1] = a[1];
    for (int i = 2; i <= n; i++) {
      pre[i] = min(a[i], pre[i - 1]);
    }
    suf[n] = a[n];
    for (int i = n - 1; i >= 1; i--) {
      suf[i] = min(a[i], suf[i + 1]);
    }
    for (int i = 2; i <= n - 1; i++) {
      if (pre[i - 1] + suf[i + 1] < a[i]) {
        fg = 0;
        break;
      }
      if (pre[i - 1] < a[i]) {
        pre[i] = min(pre[i - 1], a[i + 1] - a[i] + pre[i - 1]);
      }
    }
    if (fg)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
  return 0;
}
