import sys input = lambda : sys.stdin.readline().rstrip() write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) # sys.setrecursionlimit(3*10**5+10) def sub(a): t = [[] for _ in range(n+1)] for i in range(2*n): v = a[i] l = [] if i>0: l.append(a[i-1]) if i+1<2*n: l.append(a[i+1]) t[v].extend(l) for i in range(n+1): t[i] = tuple(sorted(t[i])) return [set(item) for item in t] t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) s1 = sub(a) s2 = sub(list(range(1,n+1)) + list(range(1,n+1))) # print(s1,s2) if all((s1[i]==s2[i] for i in range(n+1))): print("Yes") else: print("No")