#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, i, e, f, g, n, m, k, l, A[500005], B[500005], mid, le, ri,
    ans, t, maxx;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (long long i = 1; i <= n; i++) {
      cin >> A[i];
    }
    a = A[1];
    b = 0;
    k = 0;
    for (long long i = 2; i <= n; i++) {
      a = min(a, A[i] - b);
      b = A[i] - a;
      if (a + b != A[i] || min(a, b) < 0) {
        cout << "NO" << endl;
        k = 1;
        break;
      }
    }
    if (!k) cout << "YES" << endl;
  }
}
