import sys input = sys.stdin.readline #input = sys.stdin.buffer.readline def main(): T = int(input()) for _ in range(T): N = int(input()) A = list(map(int,input().split())) X = [i+1 for i in range(N)] X = X + X if X == A: print('Yes') continue for i in range(N): mid = X[i:i+N+1] mid.reverse() NX = X[:i] + mid + X[i+N+1:] #print(NX) if NX == A: print('Yes') break else: print('No') if __name__ == '__main__': main()