#include <bits/stdc++.h>
using namespace std;
bool ans[(int)(1e6 + 10)];
int a[(int)(1e6 + 10)];
int minx[(int)(1e6 + 10)];
int main() {
  ios::sync_with_stdio(0);
  int T;
  cin >> T;
  for (int cas = 1; cas <= T; cas++) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    memset(minx, 0xfffffff, (n + 5) * sizeof(int));
    minx[n] = a[n];
    for (int i = n - 1; i >= 1; i--) minx[i] = min(a[i], minx[i + 1]);
    long long sum = 0;
    long long low_num = a[1];
    long long high_num = a[1];
    bool flag = 0;
    bool res = 1;
    for (int i = 2; i <= n; i++) {
      if (a[i] > a[i - 1]) {
        if (flag) low_num = a[i - 1];
        flag = 0;
      } else if (a[i] < a[i - 1]) {
        if (!flag) {
          high_num = a[i - 1];
          sum += high_num - low_num;
          if (minx[i] - sum < 0) {
            res = 0;
            break;
          }
        }
        flag = 1;
      }
    }
    ans[cas] = res;
  }
  for (int i = 1; i <= T; i++)
    if (ans[i])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
}
