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<set>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
const int N = 60000;
bool f[N];
vector<int> p;
#define i64 long long int
i64 a[1002][1002];
void init(){
	for(int i=2; i<N; i++){
		if(!f[i])p.push_back(i);
		for(auto y : p){
			int x = y * i;
			if(x>=N)break;
			f[x] = true;
			if(i%y==0)break;
		}
	}
	reverse(p.begin(), p.end());
	p.resize(5002);
}
i64 gen(i64 ff,int t){
	if(ff > 0)
		return ff * p[t];
	else{
		ff = -ff;
		return ff * (ff+1) * p[t] * p[t+1] + 1;
	}
}
bool chk(i64 x,i64 y){
	if(x>y)swap(x,y);
	return y%x==1;
}
set<i64> s;
int main(){
	init();
	scanf("%d",&n);
	for (int i = 2, ff = 1; i <= 2 * n; i++) {
		int mid = labs(ff) + 2501;
		for (int x = 1; x < i; x++) {
			a[x][i - x] = gen(ff, mid);
			mid--;
		}
		if (ff > 0) ff = -ff;else
			ff = -ff + 1;
	}
	ios::sync_with_stdio(false);
	for(int i=1; i<=n; i++)
	for(int j=1; j<=n; j++){
		s.insert(a[i][j]);
		if(i<n)assert(chk(a[i][j], a[i+1][j]));
		if(j<n)assert(chk(a[i][j],a[i][j+1]));
		cout << a[i][j] << (j < n ? ' ' : '\n');
	}
	assert(s.size() == n*n);
	return 0;
}