#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  int n;
  int arr[30010];
  int dp[30010][2];
  int i;
  bool flag;
  cin >> t;
  while (t--) {
    cin >> n;
    for (i = 0; i < n; i++) {
      cin >> arr[i];
    }
    dp[0][0] = arr[0];
    dp[0][1] = 0;
    flag = true;
    for (i = 1; i < n; i++) {
      dp[i][0] = dp[i - 1][0];
      dp[i][1] = dp[i - 1][1];
      if (arr[i] < dp[i][0] + dp[i][1])
        dp[i][0] -= dp[i][0] + dp[i][1] - arr[i];
      else if (arr[i] > dp[i][0] + dp[i][1])
        dp[i][1] += arr[i] - (dp[i][0] + dp[i][1]);
      if (dp[i][0] < 0) {
        flag = false;
        break;
      }
    }
    if (flag)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
