import sys input = sys.stdin.readline for _ in range(int(input())): N = int(input()) X = [i%N+1 for i in range(2*N)] A = list(map(int, input().split())) if A==X: print('Yes') continue for i in range(N): Y = X[:i]+list(reversed(X[i:i+N+1]))+X[i+N+1:] if A==Y: print('Yes') break else: print('No')