#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long input;
    cin >> input;
    vector<long long> in(input);
    bool flag = true;
    long long sum = 0;
    for (long long i = 0; i < input; i++) {
      cin >> in[i];
    }
    long long cur = 0, curMax = INT_MIN, start = 0, end = 0;
    for (long long i = 0; i < input; i++) {
      if (cur > 0) {
        cur += in[i];
      } else {
        cur = in[i];
        start = i;
      }
      sum += in[i];
      if (curMax < cur) {
        end = i;
      }
      curMax = max(curMax, cur);
    }
    if ((start == 0 && end == input - 1) || sum > curMax) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
