#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    long long int n;
    cin >> n;
    long long int A[n + 5], B[n + 5];
    for (int i = 1; i <= n; i++) {
      cin >> A[i];
      B[i] = A[i];
    }
    long long int pre = 0;
    bool sol1 = true, sol2 = true;
    for (int i = 2; i <= n; i++) {
      A[i] -= pre;
      if (A[i] < 0) {
        sol1 = false;
        break;
      }
      if (A[i] > A[i - 1]) {
        pre += (A[i] - A[i - 1]);
        A[i] = A[i - 1];
      }
    }
    pre = 0;
    for (int i = n - 1; i >= 1; i--) {
      B[i] -= pre;
      if (B[i] < 0) {
        sol2 = false;
        break;
      }
      if (B[i] > B[i + 1]) {
        pre += (B[i] - B[i + 1]);
        B[i] = B[i + 1];
      }
    }
    if (sol1 | sol2)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
