#include #include #include using namespace std; bitset<1344> wow[40040]; bitset<1000> ev[202]; int N, M; char B[202][202]; int main() { scanf ("%d %d", &N, &M); for (int k = 0; k < M; k++){ int C = 0, L = N + N + (N - 1) * 2 + 1 + (N - 1) * 2 + 1; for (int i = 0; i < N; i++){ scanf ("%s", &B[i]); for (int j = 0; j < N; j++){ wow[C] = bitset<1344>(); wow[C][i] = wow[C][N + j] = wow[C][N + N + i + j] = wow[C][N + N + (N - 1) * 2 + 1 + (N - 1) - i + j] = 1; if (B[i][j] == '#') wow[C][L] = 1; C++; } } bitset<1344> lose; vector ls; for (int i = 0, j = 0; i < C && j < L; j++){ for (int k = i; k < C; k++) if (wow[k][j]){ swap(wow[i], wow[k]); break; } if (!wow[i][j]){ lose[j] = 1; ls.push_back(j); continue; } for (int k = 0; k < C; k++) if (k != i && wow[k][j]) wow[k] ^= wow[i]; i++; } for (int i = 0, c = 0; i < C; i++) if (wow[i].count() == wow[i][L]){ ev[k][c++] = wow[i][L]; } } for (int i = 0; i < M; i++, puts("")) for (int j = i + 1; j < M; j++){ int g = (ev[i] ^ ev[j]).count() == 0; printf ("%d", g); } return 0; }