Codeforces Round 851 (Div. 2)
C
Matching Numbers
Codeforces
1300
原题
← BD →
翻译中…

You are given an integer $n$. Pair the integers $1$ to $2n$ (i.e. each integer should be in exactly one pair) so that each sum of matched pairs is consecutive and distinct.

翻译中…

Formally, let $(a_i, b_i)$ be the pairs that you matched. $\{a_1, b_1, a_2, b_2, \ldots, a_n, b_n\}$ should be a permutation of $\{1, 2, \ldots, 2n\}$. Let the sorted list of $\{a_1+b_1, a_2+b_2, \ldots, a_n+b_n\}$ be $s_1 \lt s_2 \lt \ldots \lt s_n$. We must have $s_{i+1}-s_i = 1$ for $1 \le i \le n - 1$.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 500$). The description of the test cases follows.

翻译中…

For each test case, a single integer $n$ ($1 \leq n \leq 10^5$) is given.

翻译中…

It is guaranteed that the sum of $n$ over all test cases doesn't exceed $10^5$.

翻译中…

Output

翻译中…

For each test case, if it is impossible to make such a pairing, print "No".

翻译中…

Otherwise, print "Yes" followed by $n$ lines.

翻译中…

At each line, print two integers that are paired.

翻译中…

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

翻译中…

If there are multiple solutions, print any.

翻译中…

Note

翻译中…

For the third test case, each integer from $1$ to $6$ appears once. The sums of matched pairs are $4+2=6$, $1+6=7$, and $3+5=8$, which are consecutive and distinct.

翻译中…

样例

Input #1
4
1
2
3
4
Output #1
Yes
1 2
No
Yes
1 6
3 5
4 2
No
InputCopy OutputCopy
题目信息
题号
1788C
时间限制
1 s
内存限制
256 MB
标签
构造
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。