#include <bits/stdc++.h>
using namespace std;
int a[300005];
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
      scanf("%d", a + i);
    }
    if (n < 3) {
      puts("YES");
      continue;
    }
    int sum = 0;
    bool flag1 = 1, flag2 = 1;
    for (int i = 1; i < n; i++) {
      if (a[i] - sum < 0) flag1 = 0;
      if (a[i] <= a[i - 1])
        continue;
      else
        sum += a[i] - a[i - 1];
    }
    sum = 0;
    for (int i = n - 2; i >= 0; i--) {
      if (a[i] - sum < 0) flag2 = 0;
      if (a[i] <= a[i + 1])
        continue;
      else
        sum += a[i] - a[i + 1];
    }
    if (flag1 || flag2)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
