#include <iostream>
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define endl "\n"
//#define vector<ll> vll;
//#define fi first;
//#define se second;
//#define pb push_back;
typedef pair<ll, ll> pll;
const ll dim=1e6+6;
ll n, t;
string s;
ll a[dim];
ll pr[dim], vis[dim];
deque<ll> dq;
ll ans=0;
ll cur=0;


int main()
{
    ll x, y, cnt;
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>t;
   //t=1;
    while(t--){
        cin>>n;
        for(int i=1; i<=n; i++){
            cin>>a[i];
        }
        ll ans=0;
        sort(a+1, a+1+n);
        do{
            ll fl=0;
            for(int i=2; i<=n-1; i++){
                if(2*a[i]>a[i-1]+a[i+1])fl=1;
            }
            if(fl==0){
                ans=1;
//                for(int i=1; i<=n; i++){
//                    cout<<a[i]<<" ";
//                }
//                cout<<endl;
                break;
            }



        }while(next_permutation(a+1, a+1+n));
        if(ans==1)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;



    }


    return 0;
}
