func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e3;   bool possible, check[N << 2], mark[N << 2];   vector<int> topol, from[N << 2], to[N << 2];   int n, m, c, d[N], com[N << 2], row[N], col[N], a[N][N], b[N][N];   void dfs_scc(int u, int c) {     com[u] = c;     mark[u] = true;     for (auto v : to[u])       if (!mark[v]) dfs_scc(v, c);   }   void strongly_connected_components() {     memset(mark, false, sizeof mark);     for (int i = 0; i < n << 2; i++)       if (check[i] && !mark[i]) dfs_scc(i, ++c);   }   void dfs_topolo(int u) {     mark[u] = true;     for (auto v : from[u])       if (!mark[v]) dfs_topolo(v);     topol.push_back(u);   }   void topological_sort() {     for (int i = 0; i < n << 2; i++)       if (check[i] && !mark[i]) dfs_topolo(i);     reverse(topol.begin(), topol.end());   }   void input(int w) {     for (int i = 0; i < n; i++) {       string s;       cin >> s;       for (int j = 0; j < n; j++) (w ? a[i][j] : b[i][j]) = s[j] -  0 ;     }   }   void add_edge(int u, int v) {     check[u] = check[v] = true;     from[u].push_back(v);     from[v].push_back(u);     to[u].push_back(v);     to[v].push_back(u);   }   void add_clause(int u, int v) {     add_edge(u ^ 1, v);     add_edge(u, v ^ 1);   }   void F2(int u, int v) {     int k = a[u][v] + b[u][v];     if (k == 1) (d[v] & 1 ? row[u] : col[v]) = 1;   }   void F1(int u, int v, int k) {     k += a[u][v] + b[u][v];     if (k == 3) {       add_clause(u << 1, (v + n) << 1);       return;     }     if (k == 1) {       cout << -1;       exit(0);     }     if (k == 4 || (!a[u][v] && k == 2)) {       add_clause(u << 1 ^ 1, (v + n) << 1);       return;     }   }   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n;     input(1), input(0);     string s;     cin >> s;     for (int i = 0; i < n; i++) d[i] = s[i] -  0 ;     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) d[i] == d[j] ? F1(i, j, d[i] + d[j]) : F2(i, j);     topological_sort();     strongly_connected_components();     for (int i = 0; i < n << 1; i++)       if (check[i << 1] && com[i << 1] == com[i << 1 ^ 1]) {         cout << -1;         return 0;       } else if (check[i << 1] && com[i << 1] < com[i << 1 ^ 1])         i >= n ? col[i - n] = 1 : row[i] = true;     int cnt = 0;     for (int i = 0; i < n; i++) cnt += row[i] + col[i];     cout << cnt << endl;     for (int i = 0; i < n; i++)       if (row[i]) cout <<  row   << i << endl;     for (int i = 0; i < n; i++)       if (col[i]) cout <<  col   << i << endl;   }   