#include <bits/stdc++.h>
using namespace std;
const int oo = 1000006;
const long long MOD = 1e9 + 7;
int t, n, x, dem;
long long yass, adel, tmp, luu1, luun, luudem;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    adel = 0;
    yass = 0;
    tmp = 0;
    dem = 0;
    for (int i = 1, _b = n; i <= _b; i++) {
      cin >> x;
      yass += x;
      if (i == 1) luu1 = x;
      if (i == n) luun = x;
      if (tmp + x > 0) {
        tmp += x;
        dem++;
      } else
        tmp = 0, dem = 0;
      if (adel < tmp) adel = tmp, luudem = dem;
    }
    if (luudem == n && adel == tmp) adel -= min(luu1, luun);
    if (yass > adel)
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }
}
