T = int(input()) for _ in range(T): N = int(input()) A = list(map(int, input().split())) X = list(map(lambda x: (x % N) + 1, range(2 * N))) flg = A == X for i in range(N): B = A[:i] + A[i : i + N + 1][::-1] + A[i + N + 1 :] if X == B: flg = True print("Yes" if flg else "No")