#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    long long int z = 0;
    long long int p = accumulate(a, a + n, z);
    long long int k = 0, maxi = -999999999999999, flag = 0, x = 0, y = 0;
    for (int i = 0; i < n; i++) {
      k = k + a[i];
      if (k > maxi) {
        maxi = k;
        y = i;
      }
      if (k <= 0) {
        k = 0;
        x = i;
      }
    }
    if (maxi > p)
      cout << "NO" << endl;
    else if (maxi == p && x == 0 && y == n - 1)
      cout << "YES" << endl;
    else if (maxi < p)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
