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 maxn=1e3+10;
int n;
ll a[maxn][maxn];
set<ll> s;
vector<int> v;

inline ll gcd(ll a,ll b){
	return b?gcd(b,a%b):a;
}
inline ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}
const int xx=1e6;
int pcnt,p[xx];
bool prm[xx];
map<int,int> mp1,mp2;

int main(){
	for(int i=2;i<xx;++i){
		if(!prm[i])
			p[++pcnt]=i;
		for(int j=1;j<=pcnt&&(ll)i*p[j]<xx;++j){
			prm[i*p[j]]=1;
			if(i%p[j]==0)
				break;
		}
	}
	cin>>n;
	for(int i=0;i<=n+1;++i)
		for(int j=0;j<=n+1;++j)
			a[i][j]=1;
	{
		int cnt=0;
		for(int i=2;i<=2*n;++i)
			if(i&1)
				mp1[i]=p[++cnt];
		for(int i=1-n;i<=n-1;++i)
			if(i&1)
				mp2[i]=p[++cnt];
	}
	for(int i=1;i<=n;++i)
		for(int j=1,cnt=1;j<=n;++j)
			if(i+j&1){
				ll now=mp1[i+j]*mp2[i-j];
				a[i][j]=now;
				s.insert(now);
			}
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			if(i+j&1^1){
				ll tmp=lcm(a[i-1][j],a[i][j-1]);
				tmp=lcm(tmp,a[i][j+1]);
				tmp=lcm(tmp,a[i+1][j]);
				ll now=tmp+1;
				while(s.count(now))
					now+=tmp;
				a[i][j]=now;
				s.insert(now);
			}
	for(int i=1;i<=n;++i,puts(""))
		for(int j=1;j<=n;++j){
			cout<<a[i][j]<<' ';
	//		if(a[i][j]>1e15)
	//			cerr<<"#";
		}
	return 0;
}