#include <bits/stdc++.h>
const int T_DATA = 30000;
const int N = 30000;
int T;
int n;
int a[N + 10], b[N + 10];
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
    b[1] = a[1];
    bool flg = true;
    for (int i = 2; i <= n; ++i) {
      b[i] = std::min(b[i - 1], a[i] - (a[i - 1] - b[i - 1]));
      if (b[i] < 0) {
        flg = false;
      }
    }
    if (flg) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
