#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  vector<long long> copy1(n);
  vector<long long> copy2(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
    copy1[i] = v[i];
    copy2[i] = v[i];
  }
  long long x = -1;
  long long minn = v[0];
  bool cd1 = true;
  for (long long i = 0; i < n; i++) {
    if (x == -1) {
      if (copy1[i] > minn) {
        x = (copy1[i] - minn);
        copy1[i] -= minn;
      } else {
        minn = copy1[i];
        copy1[i] = 0;
      }
    } else {
      if (copy1[i] < x) {
        cd1 = false;
        break;
      } else {
        long long t = min(copy1[i] - x, minn);
        copy1[i] -= t;
        minn = t;
        x = max(copy1[i], x);
      }
    }
  }
  int j = 0;
  while (j < n && copy1[j] == 0) {
    j++;
  }
  while (j < n - 1) {
    if (copy1[j] > copy1[j + 1]) {
      cd1 = false;
      break;
    } else {
      j++;
    }
  }
  x = -1;
  minn = v[n - 1];
  bool cd2 = true;
  for (long long i = n - 1; i >= 0; i--) {
    if (x == -1) {
      if (copy2[i] > minn) {
        x = (copy2[i] - minn);
        copy2[i] -= minn;
      } else {
        minn = copy2[i];
        copy2[i] = 0;
      }
    } else {
      if (copy2[i] < x) {
        cd2 = false;
        break;
      } else {
        long long t = min(copy2[i] - x, minn);
        copy2[i] -= t;
        minn = t;
        x = max(copy2[i], x);
      }
    }
  }
  j = n - 1;
  while (j >= 0 && copy2[j] == 0) {
    j--;
  }
  while (j >= 1) {
    if (copy2[j] > copy2[j - 1]) {
      cd2 = false;
      break;
    } else {
      j--;
    }
  }
  if (cd1 || cd2) {
    cout << "YES";
  } else {
    cout << "NO";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long test;
  test = 1;
  cin >> test;
  while (test--) {
    solve();
    cout << "\n";
  }
}
