t = int(input()) for _ in range(t): n = int(input()) A = list(map(int, input().split())) if A[0] == 1 and A[-1] == n: print('Yes') else: print('No')