#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 23;
int a[maxn], pre[maxn], suf[maxn], tag[maxn];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      tag[i] = 0;
    }
    for (int i = 2; i <= n; i++) {
      tag[i] += tag[i - 1];
      a[i] -= tag[i];
      if (a[i] > a[i - 1]) tag[i] += a[i] - a[i - 1], a[i] = a[i - 1];
    }
    int flag = 1;
    for (int i = 1; i <= n; i++) flag &= a[i] >= 0;
    if (n <= 2) flag = 1;
    puts(flag ? "YES" : "NO");
  }
}
