#include <bits/stdc++.h>   using namespace std;   int main() {     long long int test;     cin >> test;     while (test--) {       long long int n;       cin >> n;       long long int a[n];       for (int i = 0; i < n; i++) {         cin >> a[i];       }       long long int total_sum = 0;       for (int i = 0; i < n; i++) {         total_sum += a[i];       }       if (total_sum < 0 && n == 1) {         cout <<  YES  << endl;         continue;       } else if (total_sum < 0) {         cout <<  NO  << endl;         continue;       }       long long int sum = 0;       long long int max_so_far = 0;       long long int element = 0;       long long int element_f = 0;       for (int i = 0; i < n; i++) {         sum = sum + a[i];         element++;         if (sum <= 0) {           element = 0;           sum = 0;         } else if (sum > max_so_far) {           element_f = element;           max_so_far = sum;         }       }       if (max_so_far >= total_sum && element_f < n)         cout <<  NO  << endl;       else         cout <<  YES  << endl;     }     return 0;   }   