#include #include #include #include #include #include #include #include using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF 1<<30 #define MP make_pair #define mp make_pair #define pb push_back #define PB push_back #define DEBUG(x) cout<<#x<<": "<>n>>x>>y>>z; int ma[n][n]; int b[n][n][n]; REP(i,n){ REP(j,n){ ma[i][j]=i*n+j; if((i%4)==(j%4) || 3-(i%4)==(j%4)){ ma[i][j]=n*n-1-ma[i][j]; } REP(k,n){ if((ma[i][j]>>k)&1) b[i][j][k]=1; else b[i][j][k]=0; } } } int bin=0; REP(i,n){ if ((ma[y][x]>>i)%2==1 && (z>>i)%2==1){ bin |= (1<>i)%2==1 && (z>>i)%2==0){ bin |= (1<>i)%2==0 && (z>>i)%2==1){ bin |= (1<>i)%2==0 && (z>>i)%2==0){ } } REP(i,n)REP(j,n) ma[i][j]^=bin; REP(i,n){ REP(j,n){ cout<