#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 2e5 + 4;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    long long cur = 0, sum = 0, ans = -1e15;
    long long a[n];
    for (int i = 0; i < n; i++) scanf("%lld", &a[i]), sum += a[i];
    for (int i = 0; i < n - 1; i++) {
      cur = max(a[i], cur + a[i]);
      ans = max(ans, cur);
    }
    cur = 0;
    for (int i = 1; i < n; i++) {
      cur = max(a[i], cur + a[i]);
      ans = max(ans, cur);
    }
    if (sum > ans)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
