#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    int b[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      b[i] = arr[i];
    }
    int ind = -1, mn = INT_MAX;
    for (int i = 0; i < n - 1; i++) {
      if (arr[i] < arr[i + 1]) {
        ind = i;
        break;
      }
    }
    if (ind == -1) {
      cout << "YES" << endl;
    } else {
      mn = arr[ind];
      int flag = 0;
      for (int j = n - 1; j > ind + 1; j--) {
        if (arr[j] < arr[j - 1]) {
          if (arr[j - 1] - arr[j] <= mn) {
            mn -= arr[j - 1] - arr[j];
          } else {
            flag = 1;
            break;
          }
        }
      }
      if (flag == 0) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
  }
}
