#include <bits/stdc++.h>
using namespace std;
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
int test_case() {
  int n;
  cin >> n;
  vector<int> v1(n);
  for (auto& it : v1) cin >> it;
  int last = v1.front();
  long long del = 0;
  for (int i = 1; i < n; i++) {
    v1[i] -= del;
    if (v1[i] < 0) return 0;
    if (v1[i] <= last) {
      last = v1[i];
      continue;
    } else {
      del += v1[i] - last;
      v1[i] = last;
    }
  }
  last = v1.back();
  del = 0;
  for (int i = n - 2; i >= 0; i--) {
    v1[i] -= del;
    if (v1[i] < 0) return 0;
    if (v1[i] <= last) {
      last = v1[i];
      continue;
    } else {
      del += v1[i] - last;
      v1[i] = last;
    }
  }
  return 1;
}
int main() {
  file();
  fast();
  int t;
  cin >> t;
  while (t--) {
    cout << (test_case() ? "YES" : "NO") << "\n";
  }
  return 0;
}
