#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll DIM = 3e5+7;
const ll INF = 1e9+7;
int fact (int n) {
    int res=1;
    for(int i=1;i<=n;i++) res*=i;
    return res;
    }
ll n,s,t,f,b[DIM];
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>t;
    while(t--) {
        cin>>n;
        for(int i=1;i<=n;i++) cin>>b[i];
        for(int i=1;i<=fact(n); i++) {
            f=1;
            for(int i=2;i<n;i++) {
                if(b[i-1]+b[i+1]<2*b[i]) f=-1;
                if(f==-1) break;
            }
            if(f==1) break;
            next_permutation(b+1, b+1+n);
        }
        if (f==1)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

