#include <bits/stdc++.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define for1(a,b,i) for(int i=a;i<=b;++i)
#define FOR2(a,b,i) for(int i=a;i>=b;--i)
using namespace std;
typedef long long ll;
inline int read() {
    int f=1,sum=0;
    char x=getchar();
    for(;(x<'0'||x>'9');x=getchar()) if(x=='-') f=-1;
    for(;x>='0'&&x<='9';x=getchar()) sum=sum*10+x-'0';
    return f*sum;
}

#define M 505
#define N 8000
int n;
ll a[M][M];
int prime[N+5];
bool notprime[N+5];

map <ll,bool> cc;

void get_prime() {
    for1(2,N,i) {
        if(!notprime[i]) prime[++prime[0]]=i;
        for1(1,prime[0],j) {
            if(i*prime[j]>N) break;
            notprime[i*prime[j]]=1;
            if(!(i%prime[j])) break;
        }
    }
}

inline ll gcd(ll x,ll y) {return y?gcd(y,x%y):x;}
inline ll Lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main () {
    //freopen("a.in","r",stdin);
    n=read();
    if(n==2) {
        puts("4 7");
        puts("23 10");
        return 0;
    }
    get_prime();
    for1(0,n+1,i) for1(0,n+1,j) a[i][j]=1;
    for1(1,n,i) for1(1,n,j) if(!(i+j&1)) a[i][j]=prime[(i+j)/2]*prime[1000-(i-j)/2-(n+1)/2+1];
    for1(1,n,i) for1(1,n,j) if(i+j&1) a[i][j]=Lcm(Lcm(a[i-1][j],a[i][j-1]),Lcm(a[i][j+1],a[i+1][j]))+1;
    for1(1,n,i) {
        for1(1,n,j) printf("%lld ",a[i][j]);
        puts("");
    }
}