Hide

Problem F
Matrix

Construct a matrix of $n$ rows and $n$ columns, satisfying all the following constraints:

  • The elements of the matrix are integers ranging from $1$ to $2n$ (both inclusive).

  • Each integer from $1$ to $2n$ (both inclusive) should appear at least once in the matrix.

  • Let $a_{i, j}$ be the element in the $i$-th row and the $j$-th column, there exists exactly one integer quadruple $(x, y, z, w)$ such that:

    • $1 \le x < z \le n$.

    • $1 \le y < w \le n$.

    • $a_{x, y}$, $a_{x, w}$, $a_{z, y}$, $a_{z, w}$ are pairwise different.

Input

There is only one test case in each test file.

The first and only line of the input contains one integer $n$ ($2 \le n \le 50$) indicating the size of the matrix.

Output

If it is possible to construct such a matrix, first output Yes in one line. Then output $n$ lines where the $i$-th line contains $n$ integers $a_{i, 1}, a_{i, 2}, \cdots , a_{i, n}$ ($1 \le a_{i, j} \le 2n$) separated by a space, where $a_{i, j}$ is the element in the $i$-th row and the $j$-th column. If there are multiple valid answers, you can output any of them.

If it is impossible to construct such a matrix, just output No in one line.

Sample Input 1 Sample Output 1
2
Yes
1 2
3 4
Sample Input 2 Sample Output 2
3
Yes
3 2 6
4 3 3
3 1 5

Please log in to submit a solution to this problem

Log in