#include <bits/stdc++.h>
using namespace std;
const int N = 3e4 + 10;
int a[N];
int f[N];
signed main() {
  int T;
  cin >> T;
  while (T--) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]), f[i] = a[i];
    int last = f[1], v = 0;
    bool flag = true;
    for (int i = 1; i <= n; i++) {
      int t = a[i] - v;
      if (t < 0) flag = false;
      if (t > last) {
        v = a[i] - last;
      } else
        last = min(last, t);
    }
    if (flag)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
