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 <bits/stdc++.h>
#define debug(x) cerr << #x << " " << (x) << endl
using namespace std;

const int N = 505;
int n, dx[4] = {1, 0, -1, 0}, dy[4] = {0, -1, 0, 1};
long long mat[N][N], pri[N << 2];

bool check_prime (int p) {
	for (int i = 2; i * i <= p; i++) {
		if (p % i == 0) return false;
	}

	return true;
}

long long gcd (long long x, long long y) {
	if (x < y) swap(x, y);
	while (x % y) {
		long long r = x % y;
		x = y, y = r;
	}
	return y;
}

long long lcm (long long x, long long y) {
	return (x / gcd(x, y)) * y;
}
int main () {
	scanf("%d", &n);
	for (int i = 2, j = 0; j < (n << 2); i++) {
		if (check_prime(i)) pri[++j] = i;
	}

	set<long long> s;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if ((i + j) % 2 == 0) {
				mat[i][j] = pri[i + j >> 1] * pri[(j - i) / 2 + (n + 1) / 2 + n];
				s.insert(mat[i][j]);
			}
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if ((i + j) % 2 == 1) {
				long long div = mat[i][j] = 1;
				for (int k = 0; k < 4; k++) {
					int x = i + dx[k], y = j + dy[k];
					if (1 <= x && x <= n && 1 <= y && y <= n) div = lcm(div, mat[x][y]);
				}
				mat[i][j] += div;
				while (s.count(mat[i][j])) mat[i][j] += div;
				s.insert(mat[i][j]);
			}
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) printf("%lld ", mat[i][j]);
		printf("\n");
	}

	return 0;
}