QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100 Difficulty: [show]

#14979. Shiratama

Statistics

Kamome, as a big fan of Shiratama, is trying to create some paintings in the style of Shiratama.

... Well, the problem setter is too lazy to write a story, so let's get straight to the problem.

Kamome's painting can be abstracted into $p_1, p_2, \dots, p_{2n}$, which is a permutation of $1 \sim 2n$. You need to sort $p$ by performing no more than $2n$ operation 1 and no more than $2n^2$ operation 2.

  • Operation 1: For each $i = 1, 3, \dots, 2n - 1$, simultaneously swap $p_i$ and $p_{i+1}$.
  • Operation 2: Kamome selects an even number $i$ ($1 \le i \le 2n$) and swaps $p_i$ and $p_{i+1}$. Note that we consider $p_{2n+1} = p_1$.

However, sometimes it is impossible to sort this permutation using the above operations, if so, report it.

Input

Each test contains multiple test cases. The first line contains one integer $t$ ($1 \le t \le 10^5$), indicating the number of test cases. The description of the test cases follows.

The first line contains a single integer $n$ ($1 \le n \le 100$, $\sum n^2 \le 10^6$), indicating the length of the permutation.

The second line contains $2n$ integers $p_1, p_2, \dots, p_{2n}$ ($1 \le p_i \le 2n$, $p_i \ne p_j$ for $1 \le i < j \le 2n$), indicating the permutation.

Output

For each test case, if it is impossible to sort the permutation, output one word NO.

Otherwise, your output contains three lines. The first line contains one word YES, the second line contains one integer $k$ ($0 \le k \le 2n^2 + 2n$), and the third line contains $k$ integers $a_1, a_2, \dots, a_k$ ($a_i \in \{1\} \cup \{2, 4, \dots, 2n\}$), indicating the operations you perform. If $a_i = 1$ that means you perform an operation 1, otherwise that means you perform an operation 2 and choose $x = a_i$.

Note that you can't use more than $2n$ operation 1 and $2n^2$ operation 2.

If there are multiple possible answers, you may output any of them.

Example

Input

3
2
1 3 4 2
2
2 4 1 3
3
1 2 4 3 5 6

Output

NO
YES
2
2 1
YES
7
2 4 1 6 1 2 4

Note

For test case 2, the change of permutation is shown as follows:

$$[2, \underline{4, 1}, 3] \to [\underline{2, 1}, \underline{4, 3}] \to [1, 2, 3, 4]$$

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.