#include <bits/stdc++.h>
using namespace std;
long cupcakes[100000];
int main() {
  int t, n;
  long long soma, resposta;
  int i, j, k, achou;
  cin >> t;
  while (t--) {
    soma = 0;
    achou = false;
    cin >> n;
    for (i = 0; i < n; i++) {
      cin >> cupcakes[i];
      soma += cupcakes[i];
    }
    resposta = 0;
    for (i = 0; i < n - 1; i++) {
      resposta = max(resposta + cupcakes[i], (long long)cupcakes[i]);
      if (resposta >= soma) {
        achou++;
        break;
      }
    }
    resposta = 0;
    for (i = 1; i < n; i++) {
      resposta = max(resposta + cupcakes[i], (long long)cupcakes[i]);
      if (achou || resposta >= soma) {
        achou++;
        break;
      }
    }
    if (achou)
      cout << "NO";
    else
      cout << "YES";
    if (t) cout << endl;
  }
}
