#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (auto &i : a) cin >> i;
    long long s = 0, mn = 0, mx = a[0];
    vector<long long> ac(n);
    for (int i = 0; i < n; ++i) {
      if (i + 1 != n) {
        s += a[i];
        mx = max(mx, s - mn);
        mn = min(mn, s);
        ac[i] = s;
        continue;
      }
      s += a[i];
      mx = max(mx, s - *min_element(ac.begin(), ac.end() - 1));
    }
    if (s > mx)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
