T = int(input()) for _ in [0] * T: N = int(input()) H = list(map(int, input().split())) L = [] for i in range(N - 1): L.append(H[i] < H[i + 1]) A = [] B = [] for i in range(N - 2): if not L[i] and L[i + 1]: A.append(i) for i in range(N - 2): if L[i] and not L[i + 1]: B.append(i) if len(A) == 2 and len(B) == 1 and A[0] < B[0] < A[1]: print("Yes") else: print("No")