#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i) cin >> a[i];
    string ans = "YES";
    vector<int> inc(n + 1), dec(n + 1, 0);
    inc[1] = 0, dec[1] = a[1];
    for (int i = 2; i <= n; ++i) {
      if (inc[i - 1] <= a[i]) {
        inc[i] = inc[i - 1];
        dec[i] = a[i] - inc[i - 1];
        if (dec[i] > dec[i - 1]) {
          int to_shift = dec[i] - dec[i - 1];
          inc[i] += to_shift, dec[i] -= to_shift;
          if (inc[i] > a[i] or inc[i] < 0) {
            ans = "NO";
            break;
          }
        }
      } else {
        ans = "NO";
        break;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
