import random
import sys
from itertools import permutations
t = int(input())
for _ in range(t):
    n = int(input())
    arr = list(map(int,sys.stdin.readline().split()))
    ans = 'NO'
    per = list(permutations(arr))
    for p in per:
        if ans == 'YES':break
        f = 0
        for i in range(1,n-1):
            if p[i-1]+p[i+1] < 2*p[i]:
                f = 1
                break
        if f == 0:
            #print(p)
            ans = 'YES'
    print(ans)
    
