func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = 3.141592653589793;   const long long I_MAX = 1LL << 60;   long long mod = 1000000007;   const long long maxN = 2E5;   vector<long long> inv(maxN + 5, 1);   vector<long long> fac(maxN + 5, 1);   void ADD(long long &x, long long y) {     x += y;     if (x >= mod) x -= mod;     if (x < 0) x += mod;   }   void MUL(long long &x, long long y) {     x *= y;     x = (x % mod + mod) % mod;   }   long long mypow(long long b, long long e) {     long long ans = 1;     while (e) {       if (e & 1) MUL(ans, b);       MUL(b, b);       e >>= 1;     }     return ans;   }   long long modinv(long long n) { return mypow(n, mod - 2); }   void calcInv(long long n) {     for (int i = 2; i <= n; ++i) {       inv[i] = (mod - mod / i) * inv[mod % i] % mod;     }   }   void calcFac(long long n) {     for (int i = 2; i <= n; ++i) {       fac[i] = fac[i - 1] * i % mod;     }   }   long long cm(long long a, long long b) {     long long ans = 1;     if (a < b) return 0;     MUL(ans, inv[fac[a - b]]);     MUL(ans, inv[fac[b]]);     MUL(ans, fac[a]);     return ans;   }   long long Lucas(long long n, long long m) {     if (m == 0) return 1;     return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;   }   long long doLucas(long long n, long long m) {     calcInv(mod);     calcFac(mod);     return Lucas(n, m);   }   const long long maxn = 1E5;   void precal() { return; }   void solve() {     long long n;     scanf( %I64d , &n);     int pln[n + 5][n + 5];     memset(pln, -1, sizeof(pln));     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j) {         if ((i & 1) and (j & 1))           pln[i][j] = 0;         else if ((i & 1))           pln[i][j] = 2;         else if ((j & 1))           pln[i][j] = 4;         else           pln[i][j] = 6;       }     pln[1][1] = 1;     pln[n][n] = 0;     int rep;     for (int i = 1; i <= n; i += 2) {       for (int j = 1; j <= n - 2 - 2 * (i == n); j += 2) {         printf( ? %d %d %d %d n , i, j, i, j + 2);         fflush(stdout);         scanf( %d , &rep);         if (rep == 1) {           pln[i][j + 2] = pln[i][j];         } else {           pln[i][j + 2] = pln[i][j] ^ 1;         }       }       if (i + 2 <= n) {         printf( ? %d %d %d %d n , i, 1, i + 2, 1);         fflush(stdout);         scanf( %d , &rep);         if (rep == 1) {           pln[i + 2][1] = pln[i][1];         } else {           pln[i + 2][1] = pln[i][1] ^ 1;         }       }     }     for (int i = 2; i <= n; i += 2) {       for (int j = 1; j <= n - 2; j += 2) {         printf( ? %d %d %d %d n , i, j, i, j + 2);         fflush(stdout);         scanf( %d , &rep);         if (rep == 1) {           pln[i][j + 2] = pln[i][j];         } else {           pln[i][j + 2] = pln[i][j] ^ 1;         }       }       if (i + 2 <= n) {         printf( ? %d %d %d %d n , i, 1, i + 2, 1);         fflush(stdout);         scanf( %d , &rep);         if (rep == 1) {           pln[i + 2][1] = pln[i][1];         } else {           pln[i + 2][1] = pln[i][1] ^ 1;         }       }     }     for (int i = 1; i <= n; i += 2) {       for (int j = 2; j <= n - 2; j += 2) {         printf( ? %d %d %d %d n , i, j, i, j + 2);         fflush(stdout);         scanf( %d , &rep);         if (rep == 1) {           pln[i][j + 2] = pln[i][j];         } else {           pln[i][j + 2] = pln[i][j] ^ 1;         }       }       if (i + 2 <= n) {         printf( ? %d %d %d %d n , i, 2, i + 2, 2);         fflush(stdout);         scanf( %d , &rep);         if (rep == 1) {           pln[i + 2][2] = pln[i][2];         } else {           pln[i + 2][2] = pln[i][2] ^ 1;         }       }     }     for (int i = 2; i <= n; i += 2) {       for (int j = 2; j <= n - 2; j += 2) {         printf( ? %d %d %d %d n , i, j, i, j + 2);         fflush(stdout);         scanf( %d , &rep);         if (rep == 1) {           pln[i][j + 2] = pln[i][j];         } else {           pln[i][j + 2] = pln[i][j] ^ 1;         }       }       if (i + 2 <= n) {         printf( ? %d %d %d %d n , i, 2, i + 2, 2);         fflush(stdout);         scanf( %d , &rep);         if (rep == 1) {           pln[i + 2][2] = pln[i][2];         } else {           pln[i + 2][2] = pln[i][2] ^ 1;         }       }     }     printf( ? %d %d %d %d n , 1, 1, 2, 2);     fflush(stdout);     scanf( %d , &rep);     if (rep == 1) {       for (int i = 2; i <= n; i += 2)         for (int j = 2; j <= n; j += 2) {           pln[i][j] ^= 7;         }     } else {       for (int i = 2; i <= n; i += 2)         for (int j = 2; j <= n; j += 2) {           pln[i][j] ^= 6;         }     }     printf( ? %d %d %d %d n , 1, 2, 2, 3);     fflush(stdout);     scanf( %d , &rep);     if (rep == 1) {       int x = pln[2][3] ^ 2;       for (int i = 2; i <= n; i += 2)         for (int j = 1; j <= n; j += 2) {           pln[i][j] ^= x;         }     } else {       int x = pln[2][3] ^ 3;       for (int i = 2; i <= n; i += 2)         for (int j = 1; j <= n; j += 2) {           pln[i][j] ^= x;         }     }     int px = n, py = n;     for (int i = 2; i <= n; ++i) {       for (int j = 3; j <= n; ++j) {         if (pln[i - 1][j - 2] == pln[i][j - 1] and pln[i][j - 2] == pln[i][j]) {           px = i;           py = j;         }         if (pln[i - 1][j - 2] != pln[i][j - 1] and pln[i][j - 2] != pln[i][j]) {           px = i;           py = j;         }         if (pln[i - 1][j - 2] == pln[i][j - 1] and             pln[i - 1][j - 1] == pln[i][j]) {           px = i;           py = j;         }         if (pln[i - 1][j - 2] != pln[i][j - 1] and             pln[i - 1][j - 1] != pln[i][j]) {           px = i;           py = j;         }         if (pln[i - 1][j - 2] == pln[i - 1][j] and pln[i][j - 2] == pln[i][j]) {           px = i;           py = j;         }         if (pln[i - 1][j - 2] != pln[i - 1][j] and pln[i][j - 2] != pln[i][j]) {           px = i;           py = j;         }       }     }     printf( ? %d %d %d %d n , px - 1, py - 2, px, py);     fflush(stdout);     scanf( %d , &rep);     if (px % 2 != py % 2) {       if (rep == 1) {         int x = pln[px][py] ^ pln[px - 1][py - 2];         for (int i = 2; i <= n; i += 2)           for (int j = 1; j <= n; j += 2) {             pln[i][j] ^= x;           }         for (int i = 1; i <= n; i += 2)           for (int j = 2; j <= n; j += 2) {             pln[i][j] ^= x;           }       } else {         int x = pln[px][py] ^ pln[px - 1][py - 2] ^ 1;         for (int i = 2; i <= n; i += 2)           for (int j = 1; j <= n; j += 2) {             pln[i][j] ^= x;           }         for (int i = 1; i <= n; i += 2)           for (int j = 2; j <= n; j += 2) {             pln[i][j] ^= x;           }       }     } else {       if (rep == 1) {         int x = pln[px][py] ^ pln[px - 1][py - 2];         for (int i = 2; i <= n; i += 2)           for (int j = 1; j <= n; j += 2) {             pln[i][j] ^= x;           }         for (int i = 1; i <= n; i += 2)           for (int j = 2; j <= n; j += 2) {             pln[i][j] ^= x;           }       } else {         int x = pln[px][py] ^ pln[px - 1][py - 2] ^ 1;         for (int i = 2; i <= n; i += 2)           for (int j = 1; j <= n; j += 2) {             pln[i][j] ^= x;           }         for (int i = 1; i <= n; i += 2)           for (int j = 2; j <= n; j += 2) {             pln[i][j] ^= x;           }       }     }     printf( ! n );     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= n; ++j) {         printf( %d , pln[i][j]);       }       printf(  n );     }     fflush(stdout);   }   int main() {     precal();     int t = 1;     for (int i = 1; i <= t; ++i) {       solve();     }     return 0;   }   