#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define lf long double
#define all(vec) vec.begin(), vec.end()
#define rall(vec) vec.rbegin(), vec.rend()
#define nl "\n"
#define chmyax(a,b) a=max(a,b)
#define chmyin(a,b) a=min(a,b)

struct boy{
    ll a;
    ll b;
    ll c;
};

struct pair_hash{
    size_t operator()(pair<ll,ll> pr) const {
        return hash<ll>()(pr.first)^hash<ll>()(pr.second);
    }
};

bool check(vector<ll> &arr){
    for (ll i=1;i<arr.size()-1){
        if (arr[i-1]+arr[i+1]<2*arr[i])return false;
    }
    return true;
}

void solve(){
    ll n;
    cin>>n;
    vector<ll> arr(n);
    for (ll i=0;i<n;i++){
        cin>>arr[i];
    }
    bool yes=false;
    do{
        if (check(arr)){
            yes=true;
            break;
        }
    }while(next_permutation(all(arr)));
    if (yes)cout<<"YES"<<nl;
    else cout<<"NO"<<nl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("in","r",stdin);
    ll a,b,c,d,e,f,g;
    ll t;
    cin>>t;
    while (t--){
        solve();
    }
}