#include <bits/stdc++.h>

using namespace std;
int t, n;
bool ans, tek, nic;
vector<int> A(300001), B(300001), Perm(0);
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> t;
    for (int _ = 0; _ < t; ++_) {
        cin >> n;
        for (int i = 0; i < n; ++i) {cin >> A[i]; Perm.push_back(i);}
        ans = false;
        while (next_permutation(Perm.begin(), Perm.end())) {
            tek = true;
            for (int j = 0; j < n; ++j) B[j] = A[Perm[j]];
            for (int j = 1; j < n - 1; ++j) if (B[j - 1] + B[j + 1] < 2 * B[j]) {tek = false; break;}
            if (tek) {ans = true; break;}
        }
        if (ans) cout << "YES\n"; else cout << "NO\n";
        Perm.clear();
    }
}
