#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    long long a[100001];
    long long y = 0;
    long long thissum = 0, maxsum = 0;
    int count = 1;
    for (int i = 0; i < n; i++) {
      scanf("%lld", &a[i]);
      y += a[i];
    }
    thissum = a[0];
    maxsum = a[0];
    int temp = 1;
    for (int i = 1; i < n; i++) {
      if (thissum > 0) {
        thissum += a[i];
        temp++;
      } else {
        thissum = a[i];
        temp = 1;
      }
      if (thissum > maxsum) {
        maxsum = thissum;
        count = temp;
      }
    }
    int flag;
    if (y > maxsum) {
      flag = 1;
    } else {
      if (y == maxsum && count == n) {
        maxsum = maxsum - min(a[0], a[n - 1]);
        if (y > maxsum) {
          flag = 1;
        } else {
          flag = 0;
        }
      } else {
        flag = 0;
      }
    }
    if (flag == 1) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
