#include <bits/stdc++.h>
using namespace std;
bool compare(const pair<int, int> &a, const pair<int, int> &b) {
  return a.first > b.first;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> heights;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      heights.push_back(x);
    }
    int min_peak = 1e7;
    bool possible = true;
    for (int i = 0; i < n - 1; i++) {
      if (heights[i] < min_peak) min_peak = heights[i];
      if (heights[i] > heights[i + 1]) {
        min_peak -= heights[i] - heights[i + 1];
        if (min_peak < 0) {
          possible = false;
          break;
        }
      }
    }
    if (possible) {
      cout << "YES\n";
      continue;
    }
    possible = true;
    for (int i = n - 1; i > 0; i--) {
      if (heights[i] < min_peak) min_peak = heights[i];
      if (heights[i] > heights[i - 1]) {
        min_peak -= heights[i] - heights[i - 1];
        if (min_peak < 0) {
          possible = false;
          break;
        }
      }
    }
    if (possible)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
