#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define str string
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int) a.size()
#define fi first
#define se second
// using namespace __gnu_pbds;
// #define o_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;

mt19937 rng(474);

int getnum(int l,int r){
    uniform_int_distribution<int> dist(l,r);
    return dist(rng);
}

void solve(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int &i : a) cin >> i;
    bool ans = false;
    bool good2 = true;
    for(int i = 1;i<n-1;++i){
        if(a[i-1]+a[i+1] < 2*a[i]) good2 = false;
    }
    if(good2) ans = true;
    vector<int> b;
    for(int i = 0;i<n;++i) b.pb(i);
    while(next_permutation(all(b))){
        bool good = true;
        for(int i = 1;i<n-1;++i){
            if(a[b[i-1]]+a[b[i+1]] < 2*a[b[i]]) good = false;
        }
        if(good) ans = true;
    }
    cout << (ans ? "YES" : "NO") << '\n';
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin >> t;
    while(t--) solve();
}