#include <bits/stdc++.h>
using namespace std;
long long func(long long arr[], int n) {
  long long maxx = INT_MIN;
  long long curr = 0;
  for (int i = 0; i < n - 1; i++) {
    curr = max(curr + arr[i], arr[i]);
    maxx = max(curr, maxx);
  }
  return maxx;
}
long long func1(long long arr[], int n) {
  long long maxx = INT_MIN;
  long long curr = 0;
  for (int i = 1; i < n; i++) {
    curr = max(curr + arr[i], arr[i]);
    maxx = max(curr, maxx);
  }
  return maxx;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long arr[n];
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      sum += arr[i];
    }
    long long a = func(arr, n);
    long long b = func1(arr, n);
    long long h = max(a, b);
    if (h >= sum)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}
