#include <iostream>
#include <utility>
#include <vector>

using namespace std;
typedef pair<int, int> P;

int n;
int ans[505][505];

int main(void)
{
	cin >> n;
	if(n == 1){
		cout << "Yes" << endl;
		cout << 1 << endl;
		return 0;
	}
	if(n%2){
		cout << "No" << endl;
		return 0;
	}
	for(int i = 1; i <= n-1; i++){
		for(int j = 1; j <= n-1; j++){
			if(i < j) continue;
			ans[i][j] = (i+j-2)%(n-1)+1;
		}
	}
	for(int j = 1; j <= n-1; j++){
		ans[n][j] = ans[j][j];
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(i >= j) continue;
			ans[i][j] = ans[j][i] + n-1;
		}
	}
	for(int i = 1; i <= n; i++) ans[i][i] = 2*n-1;
	
	cout << "Yes" << endl;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			cout << ans[i][j];
			if(j < n) cout << " ";
		}
		cout << endl;
	}
	
	return 0;
}
