T = int(input()) for t in range(T): N = int(input()) A = list(map(int, input().split())) if sorted(A) != sorted(list(range(1,N+1)) * 2): print("No") continue if A[0] != 1 or A[2 * N - 1] != N: print("No") continue for i in range(1, 2 * N): if not(abs(A[i] - A[i - 1]) == 1 or abs(A[i] - A[i - 1]) == N - 1): print("No") break else: print("Yes")