# 作れる全パターンを作ってみるか from collections import deque T = int(input()) for t in range(T): N = int(input()) A = tuple(list(map(int, input().split()))) B = [a for a in range(1, N+1)]+[a for a in range(1, N+1)] que = deque() que.append(B) visited = set() visited.add(tuple(B)) while que: current = que.popleft() test = False for i in range(N*2): for j in range(i+1, N*2): if current[i]==current[j] and j-i>1: temp = current[:i]+current[i:j+1][::-1]+current[j+1:] if tuple(temp) not in visited: visited.add(tuple(temp)) que.append(temp) #print(len(visited)) #print(visited) if A in visited: print('Yes') else: print('No')