#include using namespace std; typedef vector VI; typedef vector VVI; #define fin "\n" inline void init(int n,VVI &c){ c.resize(n); for(auto &v:c){ v.resize(n); for(auto &u:v)u=0; } } void twotwo(int n,VVI &c){ init(n,c); int q=n/4; for(int i=0;ians[r][c])cnt++; return ((abs(sr-gr)+abs(sc-gc))%2)==(cnt%2); } int main(){ int n; VVI res; cin>>n; if(n==2){ cout<<"impossible"<>u; if(u==0){ u=n*n; sr=i; sc=j; } pos[u]=i*n+j; } switch(n%4){ case 0:twotwo(n,res);break; case 1:odd(n,res);bg++,ed--;break; case 2:lux(n,res);break; case 3:odd(n,res);break; default: odd(n,res);break; } if(check(res,pos,sr,sc)==false){ for(;bg