func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 2 * 1000 + 17;   int n, init[MAXN][MAXN], hope[MAXN][MAXN], c[MAXN][MAXN], r[MAXN],       cnt = 1, comp[MAXN << 2];   vector<int> out[MAXN << 2], in[MAXN << 2], order, trash;   vector<pair<string, int>> ans;   void add(int i, bool f1, int j, bool f2) {     int v = (i << 1) | f1, u = (j << 1) | f2;     out[v].push_back(u);     in[u].push_back(v);     out[u ^ 1].push_back(v ^ 1);     in[v ^ 1].push_back(u ^ 1);   }   void scc(int v, vector<int> g[], vector<int> &vec) {     comp[v] = cnt;     for (auto i : g[v])       if (!comp[i]) scc(i, g, vec);     vec.push_back(v);   }   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     char C;     cin >> n;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) cin >> C, init[i][j] = int(C -  0 );     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         cin >> C, hope[i][j] = int(C -  0 ), c[i][j] = init[i][j] ^ hope[i][j];     for (int i = 1; i <= n; i++) cin >> C, r[i] = int(C -  0 );     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         if (c[i][j] && r[i] && r[j])           add(i, true, n + j, false), add(i, false, n + j, true);         else if (c[i][j] && r[i] && !r[j])           add(i, true, n + j, true), add(i, false, n + j, true);         else if (c[i][j] && !r[i] && r[j])           add(n + j, true, i, true), add(n + j, false, i, true);         else if (c[i][j] && !r[i] && !r[j])           return cout << -1 << endl, 0;         else if (!c[i][j] && r[i] && r[j])           add(i, true, n + j, true), add(i, false, n + j, false);         else if (!c[i][j] && r[i] && !r[j])           add(i, true, n + j, false), add(i, false, n + j, false);         else if (!c[i][j] && !r[i] && r[j])           add(n + j, true, i, false), add(n + j, false, i, false);         else           ;     for (int i = 1; i <= ((n << 2) | 1); i++)       if (!comp[i]) scc(i, out, order);     cnt = 0;     memset(comp, 0, sizeof(comp));     for (int i = (n << 1); ~i; i--) {       int v = order[i];       if (!comp[v]) cnt++, scc(v, in, trash);     }     for (int i = 1; i <= (n << 1); i++) {       if (comp[i << 1] == comp[i << 1 | 1]) return cout << -1 << endl, 0;       if (comp[i << 1 | 1] > comp[i << 1]) {         if (i > n)           ans.push_back({ col , i - n - 1});         else           ans.push_back({ row , i - 1});       }     }     cout << ans.size() << endl;     for (auto i : ans) cout << i.first <<     << i.second << endl;     return 0;   }   