#include <bits/stdc++.h>
using namespace std;
long long a[30002];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long tc;
  cin >> tc;
  while (tc--) {
    long long n;
    cin >> n;
    long long ind = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] < a[ind]) ind = i;
    }
    long long sum = 0;
    for (long long i = ind - 1; i > 0; i--) {
      sum += max((long long)0, a[i] - a[i - 1]);
    }
    if (sum > a[ind]) {
      cout << "NO\n";
      continue;
    }
    a[ind] -= sum;
    sum = 0;
    for (long long i = ind + 1; i < n - 1; i++) {
      sum += max((long long)0, a[i] - a[i + 1]);
    }
    if (sum <= a[ind])
      cout << "YES";
    else
      cout << "NO";
    cout << '\n';
  }
}
