#include <bits/stdc++.h>
using namespace std;
const int N = 30005;
int t, n;
int a[N], b[N], c[N];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> c[i];
    a[1] = 0, b[1] = c[1];
    int fl = 0;
    for (int i = 2; i <= n; i++) {
      int x = max(a[i - 1], c[i] - b[i - 1]);
      a[i] = x;
      if (c[i] - a[i] < 0) {
        fl = 1;
        break;
      }
      b[i] = c[i] - a[i];
    }
    if (!fl)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
