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;
typedef long long ll;
const int dx[4]={0,0,1,-1};
const int dy[4]={1,-1,0,0};
const int N=10000;
int n,a[N],b[N],c[N],cnt,p[N],prime[N],tot;
ll num[505][505];
void shai()
{
	for (int i=2;i<N;i++)
	{
		if (!p[i]) prime[++tot]=i;
		for (int j=1;j<=tot&&prime[j]*i<N;j++)
		{
			p[prime[j]*i]=1;
			if (i%prime[j]==0) break;
		}
	}
}
ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
ll calc(int x,int y)
{
	ll Lcm=0;
	for (int i=0;i<4;i++)
	{
		int xx=x+dx[i],yy=y+dy[i];
		if (xx<1||yy<1||xx>n||yy>n) continue;
		if (!Lcm) Lcm=num[xx][yy];else Lcm=lcm(num[xx][yy],Lcm);
	}
	return Lcm+1;
}
int main()
{
	shai();
	scanf("%d",&n);
	if (n==2){
		printf("4 7\n23 10\n");
		return 0;
	}
	for (int i=2;i<=2*n;i+=2) a[i]=prime[++cnt];
	for (int i=0;i<=n-1;i+=2) b[i]=prime[++cnt];
	for (int i=2;i<=n-1;i+=2) c[i]=prime[++cnt];
	for (int i=1;i<=n;i++)
	  for (int j=1;j<=n;j++)
	  if ((i+j)%2==0)
	  {
	  	  if (i<=j) num[i][j]=(ll)a[i+j]*b[j-i];
	  	  else num[i][j]=(ll)a[i+j]*c[i-j];
	  }
	for (int i=1;i<=n;i++)
	{
	   for (int j=1;j<=n;j++)
	   {
	  	 if (num[i][j]) printf("%lld ",num[i][j]);
	  	 else printf("%lld ",calc(i,j));
	   }
	   puts("");	
	}
	return 0;
}