#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    long long tot = 0;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      tot += arr[i];
    }
    long long max = -1112147483648;
    long long val = 0;
    bool f = false;
    int start = 0, end = 0, s = 0;
    for (int i = 0; i < n; i++) {
      val = val + arr[i];
      if (max < val) {
        max = val;
        start = s;
        end = i;
      }
      if (val <= 0) {
        val = 0;
        s = i + 1;
      }
    }
    if (max > tot)
      cout << "NO\n";
    else if (max < tot)
      cout << "YES\n";
    else {
      if ((end - start + 1) == n)
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
}
