#include <bits/stdc++.h>
using namespace std;
long long INF = 1 << 28;
const double pi = acos(-1.0);
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
int dir[4][2] = {1, 0, -1, 0, 0, -1, 0, 1};
int knight[8][2] = {1, 2, 1, -2, 2, 1, 2, -1, -1, 2, -1, -2, -2, 1, -2, -1};
const long double EPS = 1e-7;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
bool cmp(int a, int b) { return a < b; }
int on(int mask, int st) { return mask | (1 << st); }
int off(int mask, int st) { return mask & (~(1 << st)); }
const int mx = 500010;
long long mod = 998244353;
long long arr[mx];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    long long tot = 0;
    long long minn = INT_MAX;
    for (int i = 0; i < n; i++) {
      scanf("%lld", &arr[i]);
      tot += arr[i];
      minn = min(minn, arr[i]);
    }
    long long sum = 0;
    long long maxx = 0;
    int countt = 0;
    int maxxcountt = 0;
    for (int i = 0; i < n; i++) {
      sum += arr[i];
      countt++;
      if (sum <= 0) {
        sum = 0;
        countt = 0;
      }
      if (sum > maxx) {
        maxx = max(maxx, sum);
        maxxcountt = countt;
      }
    }
    if (tot == sum) {
      if (maxxcountt == n) {
        cout << "YES" << endl;
      } else
        cout << "NO" << endl;
    } else if (tot > sum) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
  return 0;
}
