#include <algorithm>
#include <iostream>
#include <vector>
#include <bits/ranges_algo.h>
#include <algorithm>
#include <climits>
using namespace std;


int main() {
    int t;
    cin >> t;

    for (int i = 0; i < t; i++) {
        int n;
        cin >> n;
        vector<int> v(n);
        bool flag = true;
        for (int j = 0; j < n; j++) {
            cin >> v[j];
            if (j>0 && j<=n-2) {
                if (v[j-1] + v[j+1] < 2*v[j]) {
                    flag = false;
                }
            }
        }
        if (flag) {
            cout<<"YES"<<endl;
            continue;
        }

        do {
            bool found = true;
            for (int j = 1; j<=n-2;j++) {
                if (v[j-1] + v[j+1] < 2*v[j]) {
                    found = false;
                    break;
                }
            }
            if (found) {
                cout << "YES" << endl;
                flag = true;
                break;
            }
        }while (next_permutation(v.begin(), v.end()));

        if (!flag) {
            cout << "NO" << endl;
        }
    }

    return 0;
}