#include using namespace std; #define ll long long #define rep(i,n) for(ll i=0; i<(ll)(n); i++) #define repi(i,a,b) for(ll i=(ll)(a); i<(ll)(b); i++) using vi=vector; using vvi=vector; using vll=vector; using vvll=vector; template bool chmin(T&a,const S& b){ return a>b?a=b,1:0; } template bool chmax(T&a,const S& b){ return a; using vp=vector

; using vvp=vector; struct UnionFind { vector par,siz; UnionFind(int n) : par(n,-1),siz(n,1) {} int root(int x){ if(par[x]==-1)return x; else return par[x]=root(par[x]); } bool issame(int x,int y){ return root(x)==root(y); } bool unite(int x,int y){ x=root(x),y=root(y); if(x==y)return false; if(siz[x]=mod)x-=mod; return *this; } mint& operator-=(mint r){ if((x-=r.x)<0)x+=mod; return *this; } mint& operator*=(mint r){ x=1LL*x*r.x%mod; return *this; } mint& operator/=(mint r){ return *this*=r.inv(); } friend mint operator+(mint a,mint b){ return a+=b; } friend mint operator-(mint a,mint b){ return a-=b; } friend mint operator*(mint a,mint b){ return a*=b; } friend mint operator/(mint a,mint b){ return a/=b; } mint inv() const{return pow(mod-2);} mint pow(ll b) const{ mint a=*this,c=1; while(b){ if(b&1)c*=a; a*=a; b>>=1; } return c; } }; using vm=vector; template struct SegmentTree{ private: int _n,size,log; vector dat; void update(int k){ dat[k]=op(dat[2*k],dat[2*k+1]); } public: SegmentTree():SegmentTree(0){} SegmentTree(int n):SegmentTree(vector(n,e())){} SegmentTree(const vector& v) : _n(int(v.size())){ log=0; while((1<(2*size,e()); for(int i=0; i<_n; i++)dat[size+i]=v[i]; for(int i=size-1; i>=1; i--){ update(i); } } void set(int p,S x){ p+=size; dat[p]=x; for(int i=1; i<=log; i++)update(p>>i); } S get(int p) const {return dat[p+size];} S prod(int l,int r) const{ S sml=e(),smr=e(); l+=size; r+=size; while(l>=1; r>>=1; } } S all_prod() const {return dat[1];} }; void solve(int test){ /* int n=3; vp p; repi(i,1,n+1)repi(j,1,n+1){ p.push_back(P(i,j)); } sort(all(p)); do{ vvi a(n,vi(n)); vvi b(n,vi(n)); rep(i,n*n){ a[i/n][i%n]=p[i].first; b[i/n][i%n]=p[i].second; } int ok=1; rep(i,n-1)rep(j,n-1){ int suma=a[i][j]+a[i][j+1]+a[i+1][j]+a[i+1][j+1]; int sumb=b[i][j]+b[i][j+1]+b[i+1][j]+b[i+1][j+1]; if(suma!=sumb)ok=0; } if(ok){ rep(i,n){ rep(j,n)cout<< "(" << " " << a[i][j] << "," << b[i][j] << ")" << " "; cout << endl; } cout<< endl; } }while(next_permutation(all(p))); */ int n; cin >> n; map mp; repi(i,1,n+1)repi(j,1,n+1){ mp[i-j].push_back(P(i,j)); } vvi a(n,vi(n)),b(n,vi(n)); int pa=0; repi(d,-n,n+1){ int nd=d; if(pa)nd*=-1; vp p=mp[nd]; int cnt=0; rep(i,n){ int j=i-d; if(j>=0 && j> t; rep(test,t)solve(test); }