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<cstring>
#include<algorithm>
#include<map>
#include<cassert>
using namespace std;
long long gcd(long long a,long long b)
{
	if(!b)return a;
	return gcd(b,a%b);
}
int n;
map<long long,bool>mp;
long long a[510][510];
bool used[250050];
int p[250050],cnt;
long long calc(int i,int j)
{
	long long res=1,s;
	if(i>1)res=res/gcd(res,a[i-1][j])*a[i-1][j];
	if(i<500)res=res/gcd(res,a[i+1][j])*a[i+1][j];
	if(j>1)res=res/gcd(res,a[i][j-1])*a[i][j-1];
	if(j<500)res=res/gcd(res,a[i][j+1])*a[i][j+1];
	s=res;
	while(mp[s+1])s+=res;
	mp[s+1]=1;
	if(s+1>1e15)assert(0);
	return s+1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=62500;++i)
	{
		p[++cnt]=2*i+1;
		p[++cnt]=4*i+2;
		mp[2*i+1]=1,mp[4*i+2]=1;
	}
	int st=1,ed=125000;
	for(int i=1;i<=499;i+=2)
		for(int j=1;j<=499;j+=2)
		{
			if((i+j)&3)a[i][j+1]=p[st++],a[i+1][j]=p[st++];
			else a[i][j+1]=p[ed--],a[i+1][j]=p[ed--];
		}
	for(int i=1;i<=500;++i)
		for(int j=2-(i&1);j<=500;j+=2)a[i][j]=calc(i,j);
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=n;++j)printf("%lld ",a[i][j]);
		printf("\n");
	}
	return 0;
}