#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using PLL = pair<ll, ll>;
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;

VV<int> mat;
int N;

bool solve() {
    cin >> N;
    mat = VV<int>(N, V<int>(N));
    
    if(N == 1) return true;
    if(N & 1) return false;
    if(N == 2) {
        mat[0][1] = 1;
        mat[1][0] = 2;
        return true;
    }

    V<int> nodes(N - 1);

    auto update = [&](int num, int r, int c) {
        mat[r][c] = num;
        mat[c][r] = num + N - 1;
    };

    iota(nodes.begin(), nodes.end(), 1);
    for(int num = 1; num <= N - 1; num++) {
        int dflt = num - 1;
        update(num, 0, nodes[dflt]);
        for(int j = 1; j <= N / 2; j++) {
            int r_idx = (dflt + j) % nodes.size();
            int c_idx = (dflt - j + nodes.size()) % nodes.size();
            update(num, nodes[r_idx], nodes[c_idx]);
        }
    }

    return true;
}

bool verify() {
    V<int> ok_v(2 * N - 1);
    iota(ok_v.begin(), ok_v.end(), 0);
    for(int i = 0; i < N; i++) {
        V<int> nlis;
        for(int j = 0; j < N; j++) {
            nlis.push_back(mat[i][j]);
            nlis.push_back(mat[j][i]);
        }
        sort(nlis.begin(), nlis.end());
        auto ite = unique(nlis.begin(), nlis.end());
        nlis.erase(ite, nlis.end());
        if(ok_v != nlis) return false;
    }
    return true;
}

int main() {
    if(solve()) {
        cout << "Yes" << endl;
        // cout << verify() << endl;
        for(auto &&ele : mat) for(int i = 0; i < N; i++) cout << ele[i] + 1 << " \n"[i + 1 == N];
    } else {
        cout << "No" << endl;
    }
    return 0;
}


### Prompt

In Cpp, your task is to solve the following 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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using PLL = pair<ll, ll>;
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;

VV<int> mat;
int N;

bool solve() {
    cin >> N;
    mat = VV<int>(N, V<int>(N));
    
    if(N == 1) return true;
    if(N & 1) return false;
    if(N == 2) {
        mat[0][1] = 1;
        mat[1][0] = 2;
        return true;
    }

    V<int> nodes(N - 1);

    auto update = [&](int num, int r, int c) {
        mat[r][c] = num;
        mat[c][r] = num + N - 1;
    };

    iota(nodes.begin(), nodes.end(), 1);
    for(int num = 1; num <= N - 1; num++) {
        int dflt = num - 1;
        update(num, 0, nodes[dflt]);
        for(int j = 1; j <= N / 2; j++) {
            int r_idx = (dflt + j) % nodes.size();
            int c_idx = (dflt - j + nodes.size()) % nodes.size();
            update(num, nodes[r_idx], nodes[c_idx]);
        }
    }

    return true;
}

bool verify() {
    V<int> ok_v(2 * N - 1);
    iota(ok_v.begin(), ok_v.end(), 0);
    for(int i = 0; i < N; i++) {
        V<int> nlis;
        for(int j = 0; j < N; j++) {
            nlis.push_back(mat[i][j]);
            nlis.push_back(mat[j][i]);
        }
        sort(nlis.begin(), nlis.end());
        auto ite = unique(nlis.begin(), nlis.end());
        nlis.erase(ite, nlis.end());
        if(ok_v != nlis) return false;
    }
    return true;
}

int main() {
    if(solve()) {
        cout << "Yes" << endl;
        // cout << verify() << endl;
        for(auto &&ele : mat) for(int i = 0; i < N; i++) cout << ele[i] + 1 << " \n"[i + 1 == N];
    } else {
        cout << "No" << endl;
    }
    return 0;
}


```