#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int tc = 1;
  cin >> tc;
  while (tc--) {
    long long int n;
    cin >> n;
    long long int arr[n];
    for (long long int i = 0; i < n; ++i) {
      cin >> arr[i];
    }
    long long int inc = 0, dec = arr[0];
    string ans = "YES\n";
    for (long long int i = 1; i < n; ++i) {
      if (inc > arr[i]) {
        ans = "NO\n";
        break;
      }
      if (dec < (arr[i] - inc)) {
        inc = arr[i] - dec;
      } else {
        dec = arr[i] - inc;
      }
    }
    cout << ans;
  }
  return 0;
}
