#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int i, n;
    int a[int(3e4 + 1)], inc[int(3e4 + 1)], dec[int(3e4 + 1)];
    cin >> n;
    for (i = 0; i < n; i++) cin >> a[i];
    inc[0] = 0;
    dec[0] = a[0];
    bool possible = true;
    for (i = 1; i < n; i++) {
      if (a[i] >= a[i - 1])
        dec[i] = dec[i - 1], inc[i] = a[i] - dec[i];
      else
        inc[i] = inc[i - 1], dec[i] = a[i] - inc[i];
      if (dec[i] < 0 or inc[i] < 0) possible = false;
    }
    cout << (possible ? "YES\n" : "NO\n");
  }
  return 0;
}
