// uso #include #include using namespace std; bool solve() { int N; cin >> N; vector A(N * 2); vector acnt(N + 1); for (auto &x : A) { cin >> x; acnt[x]++; } if (A[0] != 1 or A.back() != N) return false; for (auto c : acnt) { if (c > 2) return false; } if (N == 1) return true; for (int i = 1; i < int(A.size()); i++) { if (A[i - 1] == A[i]) return false; } return true; } int main() { cin.tie(nullptr), ios::sync_with_stdio(false); int T; cin >> T; while (T--) cout << (solve() ? "Yes" : "No") << '\n'; }