import sys
from itertools import permutations

def check(a):
    for x in range(1, n-1):
        if not a[x-1]+a[x+1] >= 2*a[x]:
            return False
    return True

def solve(n,a):
    c = list(permutations(a))
    for x in c:
        if check(x):
            return "YES"
    return "NO"

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

for _ in range(t):
    n = int(sys.stdin.readline())
    a = list(map(int, sys.stdin.readline().split()))
    print(solve(n,a))