from itertools import permutations
for _ in range(int(input())):
    n = int(input())
    s = list(map(int, input().split()))
    for i in permutations(s):
        f = True
        for j in range(1, n - 1):
            if i[j - 1] + i[j + 1] < 2 * i[j]:
                f = False
                break
        if f:
            break
    if f:
        print('YES')
    else:
        print('NO')
