func_code_string: #include <bits/stdc++.h>   using namespace std;   struct tri {     tri(int x = 0, int y = 0, int z = 0) { a = x, b = y, c = z; }     int a, b, c;   } par[101][101][101];   char col[101][101];   string h[101];   int d[101][101][101];   queue<tri> q;   int main() {     int n, a, b, c;     cin >> n >> a >> b >> c;     if (a == b || b == c || a == c) {       cout << -1;       return 0;     }     for (int i = 1; i <= n; i++) {       cin >> h[i];       for (int j = 1; j <= n; j++) col[i][j] = h[i][j - 1];     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         for (int k = 1; k <= n; k++) d[i][j][k] = 1e9;     d[a][b][c] = 0;     q.push(tri(a, b, c));     while (!q.empty()) {       tri cu = q.front();       q.pop();       int dis = d[cu.a][cu.b][cu.c];       int tmp[] = {cu.a, cu.b, cu.c};       sort(tmp, tmp + 3);       int A = tmp[0], B = tmp[1], C = tmp[2];       if (A == 1 && B == 2 && C == 3) {         cout << dis << endl;         vector<pair<int, int> > m;         for (int i = dis; i > 0; i--) {           tri pare = par[cu.a][cu.b][cu.c];           if (pare.a != cu.a) m.push_back(make_pair(pare.a, cu.a));           if (pare.b != cu.b) m.push_back(make_pair(pare.b, cu.b));           if (pare.c != cu.c) m.push_back(make_pair(pare.c, cu.c));           cu = pare;         }         for (int i = dis - 1; i >= 0; i--)           cout << m[i].first <<     << m[i].second << endl;         return 0;       }       A = cu.a, B = cu.b, C = cu.c;       for (int i = 1; i <= n; i++) {         if (i != A && i != B && i != C) {           if (d[i][B][C] == 1e9 && col[A][i] == col[B][C]) {             par[i][B][C] = tri(A, B, C);             d[i][B][C] = dis + 1;             q.push(tri(i, B, C));           }           if (d[A][i][C] == 1e9 && col[B][i] == col[A][C]) {             par[A][i][C] = tri(A, B, C);             d[A][i][C] = dis + 1;             q.push(tri(A, i, C));           }           if (d[A][B][i] == 1e9 && col[C][i] == col[A][B]) {             par[A][B][i] = tri(A, B, C);             d[A][B][i] = dis + 1;             q.push(tri(A, B, i));           }         }       }     }     cout << -1;     return 0;   }   