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>
using namespace std;

int n,nw[510],pn,N,p[510],cnt;
long long ans[510][510],h[510],l[510];
map<long long,int> ma;

long long gcd(long long a,long long b) {return (!b)?a:gcd(b,a%b);}
long long lcm(long long a,long long b) {return a/gcd(a,b)*b;}

bool bo[10010];

int main()
{
	for (int i=2,cnt=0; i<=10000; i++) if (!bo[i])
	{
		if (i>=250) p[++pn]=i; 
		if (pn==251) break;
		for (int j=i; j<=10000; j+=i) bo[j]=1;
	}
	srand(12019687),scanf("%d",&N),cnt=0,n=501;
	for (int i=1; i<=n; i+=2) cnt++;
	for (int i=1; i<=cnt; i++) nw[i]=(i+1==251?254:i+1);
	random_shuffle(nw+1,nw+1+cnt);
	while (1)
	{
		ma.clear(); bool bo=0;
		for (int i=1; i<=cnt; i++) h[2*i-1]=nw[i],ma[nw[i]]=1;
		for (int i=2; i<=n; i+=2) 
		{
			h[i]=h[i-1]*h[i+1];
			if (ma[h[i]]) {bo=1; break;}
			ma[h[i]]=1;
		}
		if (!bo) break;
		random_shuffle(nw+1,nw+1+cnt);
	}
	for (int i=1; i<=cnt; i++) if (i&1) l[2*i-1]=p[i+1>>1]; else l[2*i-1]=p[pn-(i>>1)+1];
	for (int i=2; i<=n; i+=2) l[i]=l[i-1]*l[i+1];
	for (int i=0; i<=n+1; i++) ans[i][0]=ans[i][n+1]=ans[0][i]=ans[n+1][i]=1;
	ma.clear();
	for (int i=1; i<=n; i++)
		for (int j=2-(i&1); j<=n; j+=2) 
			ans[i][j]=h[i]*l[j],ma[ans[i][j]]=1;
	for (int i=1; i<=n; i++)
		for (int j=(i&1)+1; j<=n; j+=2) 
		{
			long long nw=lcm(lcm(lcm(ans[i-1][j],ans[i+1][j]),ans[i][j-1]),ans[i][j+1]);
			ans[i][j]=nw+1;
			while (ma[ans[i][j]]) ans[i][j]+=nw;
			ma[ans[i][j]]=1;
		}
	for (int i=1; i<=N; i++,puts(""))
		for (int j=1; j<=N; j++) printf("%lld ",ans[i][j]);
	return 0;
}