Problem: J: Horizontal-Vertical Permutation

Problem Statement

You are given a positive integer N. Your task is to determine if there exists a square matrix A whose dimension is N that satisfies the following conditions and provide an example of such matrices if it exists. A_{i, j} denotes the element of matrix A at the i-th row and j-th column.

* For all i, j (1 \leq i, j \leq N), A_{i, j} is an integer that satisfies 1 \leq A_{i, j} \leq 2N - 1.
* For all k = 1, 2, ..., N, a set consists of 2N - 1 elements from the k-th row or k-th column is \\{1, 2, ..., 2N - 1\\}.



If there are more than one possible matrices, output any of them.

Input


N

Input consists of one line, which contains the integer N that is the size of a square matrix to construct.

Constraint

* N is an integer that satisfies 1 \leq N \leq 500.



Output

Output `No` in a single line if such a square matrix does not exist.

If such a square matrix A exists, output `Yes` on the first line and A after that. More specifically, follow the following format.


Yes
A_{1, 1} A_{1, 2} ... A_{1, N}
A_{2, 1} A_{2, 2} ... A_{2, N}
:
A_{N, 1} A_{N, 2} ... A_{N, N}


Sample Input 1


4

Output for Sample Input 1


Yes
2 6 3 7
4 5 2 1
1 7 5 6
5 3 4 2


Sample Input 2


3

Output for Sample Input 2


No





Example

Input

4


Output

Yes
2 6 3 7
4 5 2 1
1 7 5 6
5 3 4 2

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 505

int table[SIZE][SIZE],work[SIZE][SIZE];


int main(){

	int N;
	scanf("%d",&N);

	if(N%2 == 1){

		if(N == 1){

			printf("Yes\n");
			printf("1\n");

		}else{

			printf("No\n");
		}
		return 0;
	}


	for(int row = 1; row <= N-1; row++){
		for(int col = 0; col < row; col++){

			work[row][col] = row+col;
			if(work[row][col] >= N){

				work[row][col] -= (N-1);
			}
		}
	}

	for(int i = 0; i < N; i++){

		table[i][i] = 2*N-1;
	}

	for(int col = 0; col <= N-2; col++){
		for(int row = col+2; row <= N-1; row++){
			table[row-1][col] = work[row][col];
		}
		table[N-1][col] = work[col+1][col];
	}
	for(int row = 0; row < N-1; row++){
		for(int col = row+1; col < N; col++){

			table[row][col] = (2*N-1)-table[col][row];
		}
	}

	printf("Yes\n");
	for(int row = 0; row < N; row++){
		printf("%d",table[row][0]);
		for(int col = 1; col < N; col++){

			printf(" %d",table[row][col]);
		}
		printf("\n");
	}

	return 0;
}