#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
bool sortbysecdesc(const pair<int, int> &a, const pair<int, int> &b) {
  return a.second > b.second;
}
long long int max(long long int a, long long int b) { return (a > b) ? a : b; }
long long int max(long long int a, long long int b, long long int c) {
  return max(max(a, b), c);
}
long long int maxCrossingSum(long long int arr[], long long int l,
                             long long int m, long long int h) {
  long long int sum = 0;
  long long int left_sum = INT_MIN;
  for (int i = m; i >= l; i--) {
    sum = sum + arr[i];
    if (sum > left_sum) left_sum = sum;
  }
  sum = 0;
  long long int right_sum = INT_MIN;
  for (int i = m + 1; i <= h; i++) {
    sum = sum + arr[i];
    if (sum > right_sum) right_sum = sum;
  }
  return max(left_sum + right_sum, left_sum, right_sum);
}
long long int maxSubArraySum(long long int arr[], long long int l,
                             long long int h) {
  if (l == h) return arr[l];
  long long int m = (l + h) / 2;
  return max(maxSubArraySum(arr, l, m), maxSubArraySum(arr, m + 1, h),
             maxCrossingSum(arr, l, m, h));
}
int main() {
  int n;
  cin >> n;
  while (n--) {
    int t;
    cin >> t;
    long long int a[t];
    long long int sum = 0;
    for (int i = 0; i < t; i++) {
      cin >> a[i];
      sum += a[i];
    }
    if (maxSubArraySum(a, 0, t - 2) >= sum ||
        maxSubArraySum(a, 1, t - 1) >= sum)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}
