def has_no_answer():
    print("NO")

def has_answer():
    print("YES")

t = int(input())

for _ in range(t):
    n = int(input())
    a = map(int, input().split())

    if n in a:
        has_no_answer()
    else:
        has_answer()

    