#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
typedef v(vl) vvl;
const int di[] = {-1,0,1,0}, dj[] = {0,-1,0,1}; //^<v>
//const int di[] = {-1,0,1,-1,1,-1,0,1}, dj[] = {-1,-1,-1,0,0,1,1,1};

#define bsf __builtin_ctzll
ll gcd(ll a, ll b) {
  // a = abs(a); b = abs(b);
  if (!a || !b) return a|b;
  int t = bsf(a|b); a >>= bsf(a);
  do { b >>= bsf(b); if (a > b) swap(a, b); b -= a;} while (b);
  return a << t;
}
ll lcm(ll x, ll y) { return x/gcd(x,y)*y;}
// linear sieve
vi ps, pf;
void sieve(int mx) {
  pf = vi(mx);
  rep(i,mx) pf[i] = i;
  for (int i = 2; i < mx; ++i) {
    if (pf[i] == i) ps.pb(i);
    for (int j = 0; j < sz(ps) && ps[j] <= pf[i]; ++j) {
      int x = ps[j]*i;
      if (x >= mx) break;
      pf[x] = ps[j];
    }
  }
}
inline bool isp(int x) { return pf[x] == x && x >= 2;}
vi factor(int x) { // asc
  vi res;
  while (x != 1) {
    res.pb(pf[x]);
    x /= pf[x];
  }
  return res;
}
//



int main() {
  int n = 500;
  scanf("%d",&n);
  if (n == 2) {
    cout<<"4 7"<<endl;
    cout<<"23 10"<<endl;
    return 0;
  }
  sieve(MX);
  int xs = 0, ys = 0;
  rep(i,n)rep(j,n) {
    if (~(i+j)&1) continue;
    int x = (j+(n-1-i))/2;
    int y = (i+j)/2;
    maxs(xs,x);
    maxs(ys,y);
  }
  ++xs; ++ys;
  vi px, py;
  rep(i,xs) px.pb(ps[i*2]);
  rep(i,ys) py.pb(ps[i*2+1]);
  vi sx, sy;
  while (sz(px)) {
    sx.pb(px.back());
    px.pop_back();
    reverse(rng(px));
  }
  while (sz(py)) {
    sy.pb(py.back());
    py.pop_back();
    reverse(rng(py));
  }

  vvl ans(n,vl(n,1));
  rep(i,n)rep(j,n) {
    if (~(i+j)&1) continue;
    int x = (j+(n-1-i))/2;
    int y = (i+j)/2;
    ans[i][j] = sx[x]*sy[y];
  }
  // cerr<<ans<<endl;

  ll mx = 0;
  rep(i,n)rep(j,n) {
    if ((i+j)&1) continue;
    rep(v,4) {
      int ni = i+di[v], nj = j+dj[v];
      if (ni<0||nj<0||ni>=n||nj>=n) continue;
      ans[i][j] = lcm(ans[i][j],ans[ni][nj]);
    }
    ans[i][j]++;
    maxs(mx, ans[i][j]);
  }
  // cerr<<mx<<endl;
  // cerr<<ll(1e15)<<endl;

  // set<ll> st;
  // rep(i,n)rep(j,n) st.insert(ans[i][j]); assert(sz(st) == n*n);

  rep(i,n) cout<<ans[i]<<endl;
  return 0;
}






















Measured memory_bytes: 6016