#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
double pi = acos(-1);
void fast() {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
unsigned long long modex(unsigned long long a, unsigned long long b, unsigned long long m) {
if(b == 0) return 1;
unsigned long long x = modex(a, b/2, m)%m;
x = (x*x)%m;
if(b % 2) x *= a;
return x%m;
}
unsigned long long modinv(unsigned long long b) { return modex(b, MOD - 2, MOD); }
int main() {
fast();
//freopen("func.in", "r", stdin);
// freopen("output.out", "w", stdout);
int t;
t = 1;
cin >> t;
while(t --) {
int n;
cin >> n;
vector <long long> v(n);
for(int i = 0; i < n; i ++) {
cin >> v[i];
}
long long lastMax = -1e10;
long long lastSum = 0;
string sol = "YES";
for(int i = 0; i < n; i ++) {
if(lastSum <= 0) {
lastSum = v[i];
lastMax = v[i];
} else {
lastSum += v[i];
lastMax = max(v[i], lastMax);
}
if(lastSum > lastMax) {
sol = "NO";
break;
}
}
lastMax = -1e10;
lastSum = 0;
for(int i = n-1; i >= 0; i --) {
if(lastSum <= 0) {
lastSum = v[i];
lastMax = v[i];
} else {
lastSum += v[i];
lastMax = max(v[i], lastMax);
}
if(lastSum > lastMax) {
sol = "NO";
break;
}
}
cout << sol << "\n";
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBNT0QgMTAwMDAwMDAwNwpkb3VibGUgcGkgPSBhY29zKC0xKTsKdm9pZCBmYXN0KCkge2lvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpO2Npbi50aWUoMCk7Y291dC50aWUoMCk7fQoKdW5zaWduZWQgbG9uZyBsb25nIG1vZGV4KHVuc2lnbmVkIGxvbmcgbG9uZyBhLCB1bnNpZ25lZCBsb25nIGxvbmcgYiwgdW5zaWduZWQgbG9uZyBsb25nIG0pIHsKICAgIGlmKGIgPT0gMCkgcmV0dXJuIDE7CiAgICB1bnNpZ25lZCBsb25nIGxvbmcgeCA9IG1vZGV4KGEsIGIvMiwgbSklbTsKICAgIHggPSAoeCp4KSVtOwogICAgaWYoYiAlIDIpIHggKj0gYTsKICAgIHJldHVybiB4JW07Cn0KdW5zaWduZWQgbG9uZyBsb25nIG1vZGludih1bnNpZ25lZCBsb25nIGxvbmcgYikgeyByZXR1cm4gbW9kZXgoYiwgTU9EIC0gMiwgTU9EKTsgfQoKaW50IG1haW4oKSB7CiAgICBmYXN0KCk7CiAgICAvL2ZyZW9wZW4oImZ1bmMuaW4iLCAiciIsIHN0ZGluKTsKICAgIC8vIGZyZW9wZW4oIm91dHB1dC5vdXQiLCAidyIsIHN0ZG91dCk7CiAgICBpbnQgdDsKICAgIHQgPSAxOwogICAgY2luID4+IHQ7CgogICAgCiAgICB3aGlsZSh0IC0tKSB7CiAgICAgICAgaW50IG47CiAgICAgICAgY2luID4+IG47CiAgICAgICAgCiAgICAgICAgdmVjdG9yIDxsb25nIGxvbmc+IHYobik7CgogICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpICsrKSB7CiAgICAgICAgICAgIGNpbiA+PiB2W2ldOwogICAgICAgIH0KCiAgICAgICAgbG9uZyBsb25nIGxhc3RNYXggPSAtMWUxMDsKICAgICAgICBsb25nIGxvbmcgbGFzdFN1bSA9IDA7CiAgICAgICAgc3RyaW5nIHNvbCA9ICJZRVMiOwogICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpICsrKSB7CiAgICAgICAgICAgIGlmKGxhc3RTdW0gPD0gMCkgewogICAgICAgICAgICAgICAgbGFzdFN1bSA9IHZbaV07CiAgICAgICAgICAgICAgICBsYXN0TWF4ID0gdltpXTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGxhc3RTdW0gKz0gdltpXTsKICAgICAgICAgICAgICAgIGxhc3RNYXggPSBtYXgodltpXSwgbGFzdE1heCk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGlmKGxhc3RTdW0gPiBsYXN0TWF4KSB7CiAgICAgICAgICAgICAgICBzb2wgPSAiTk8iOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIGxhc3RNYXggPSAtMWUxMDsKICAgICAgICBsYXN0U3VtID0gMDsKICAgICAgICBmb3IoaW50IGkgPSBuLTE7IGkgPj0gMDsgaSAtLSkgewogICAgICAgICAgICBpZihsYXN0U3VtIDw9IDApIHsKICAgICAgICAgICAgICAgIGxhc3RTdW0gPSB2W2ldOwogICAgICAgICAgICAgICAgbGFzdE1heCA9IHZbaV07CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBsYXN0U3VtICs9IHZbaV07CiAgICAgICAgICAgICAgICBsYXN0TWF4ID0gbWF4KHZbaV0sIGxhc3RNYXgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBpZihsYXN0U3VtID4gbGFzdE1heCkgewogICAgICAgICAgICAgICAgc29sID0gIk5PIjsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBjb3V0IDw8IHNvbCA8PCAiXG4iOwogICAgfQp9