Problem: You are given an integer N.

Construct any one N-by-N matrix a that satisfies the conditions below. It can be proved that a solution always exists under the constraints of this problem.

* 1 \leq a_{i,j} \leq 10^{15}
* a_{i,j} are pairwise distinct integers.
* There exists a positive integer m such that the following holds: Let x and y be two elements of the matrix that are vertically or horizontally adjacent. Then, {\rm max}(x,y) {\rm mod} {\rm min}(x,y) is always m.

Constraints

* 2 \leq N \leq 500

Input

Input is given from Standard Input in the following format:


N


Output

Print your solution in the following format:


a_{1,1} ... a_{1,N}
:
a_{N,1} ... a_{N,N}

Output

Print your solution in the following format:


a_{1,1} ... a_{1,N}
:
a_{N,1} ... a_{N,N}

Example

Input

2


Output

4 7
23 10

Solution (in CPP):

Solution:
#include <cstdio>
#include <cassert>
using namespace std;

typedef long long ll;

const ll INF = ll(1E15);
const int MAXN = 100000;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};

bool nprm[MAXN + 5];
int prm[MAXN + 5], pcnt;
void init() {
	for(int i=2;i<=MAXN;i++) {
		if( !nprm[i] ) prm[++pcnt] = i;
		for(int j=1;i*prm[j]<=MAXN;j++) {
			nprm[i*prm[j]] = true;
			if( i % prm[j] == 0 ) break;
		}
	}
}

ll gcd(ll x, ll y) {
	return y == 0 ? x : gcd(y, x % y);
}

ll a[505][505], p[1005], q[1005];
int main() {
	init(); int N; scanf("%d", &N);
	if( N == 2 ) {
		printf("4 7\n23 10\n");
		return 0;
	}
	int cnt = 0;
	for(int i=1;i<=N;i+=2)
		p[i] = prm[++cnt], q[i] = prm[++cnt];
	for(int i=N-(N&1);i>=0;i-=2)
		p[i] = prm[++cnt], q[i] = prm[++cnt];
		
	
	for(int i=1;i<=N;i++)
		for(int j=1;j<=N;j++)
			if( (i + j) % 2 == 0 )
				a[i][j] = p[(i + j)/2] * q[(i + N - j + 1)/2];
	for(int i=1;i<=N;i++)
		for(int j=1;j<=N;j++) {
			if( (i + j) % 2 == 0 ) continue;
			a[i][j] = 1;
			for(int o=0;o<4;o++) {
				int x1 = i + dx[o], y1 = j + dy[o];
				if( x1 < 1 || x1 > N || y1 < 1 || y1 > N ) continue;
				a[i][j] = a[i][j] / gcd(a[i][j], a[x1][y1]) * a[x1][y1];
			}
			a[i][j]++, assert(a[i][j] <= INF);
		}
	
	for(int i=1;i<=N;i++)
		for(int j=1;j<=N;j++)
			printf("%lld%c", a[i][j], j == N ? '\n' : ' ');
}