#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    int rr[n], r = 0, l = arr[n - 1];
    rr[0] = arr[0];
    for (int i = 1; i < n; i++) rr[i] = min(rr[i - 1], arr[i]);
    bool check = true;
    for (int i = n - 1; i >= 0; i--) {
      if (r > arr[i]) {
        check = false;
        break;
      }
      arr[i] -= r;
      if (l < arr[i]) {
        if (arr[i] - l > rr[i]) {
          check = false;
          break;
        }
        r += arr[i] - l;
      }
      l = min(l, arr[i]);
    }
    if (check)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
