def solve(): n=int(input()) a=list(map(int,input().split())) b=[i%n+1 for i in range(2*n)] if a==b: print('Yes') return for i in range(2*n): for j in range(i+1,2*n): if b[i]==b[j]: c=b[:i+1]+b[j-1:i:-1]+b[j:] if a==c: print('Yes') return print('No') for _ in range(int(input())): solve()