#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vt vector
void solve(){
	int n; cin>>n; vt<int> a(n);
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	bool flag=0;
	int fact[8] = {1, 1, 2, 6, 24, 120, 720, 7*720};
	for(int i=1; i<n-1; i++){
		if(a[i]*2>a[i-1]+a[i+1]){flag=1; break;}
	}
	if(!flag){
		cout<<"YES\n"; return;
	}
	for(int i=0; i<fact[n]-1; i++){
		next_permutation(a.begin(), a.end());
		//for(auto i:a){
		//	clog<<i<<" ";
		//}
		//clog<<"\n";
		flag=0;
		for(int i=1; i<n-1; i++){
			if(a[i]*2>a[i-1]+a[i+1]){flag=1; break;}
		}
		if(!flag){
			cout<<"YES\n"; return;
		}
	}
	cout<<"NO\n";
}
signed main(){
	int t; cin>>t; while(t--) solve();
}