from itertools import permutations
import sys

T = int(sys.stdin.readline())

def test(array):
    for i in range(1, len(array)-1):
        if array[i-1] + array[i+1] < 2 * array[i]:
            return False
    return True

for _ in range(T):
    sys.stdin.readline()
    a = tuple(map(int, sys.stdin.readline().split()))
    solution_exists = False
    for permtation in permutations(a):
        if test(permtation):
            solution_exists = True
            break
    if solution_exists:
        print("YES")
    else:
        print("NO")