func_code_string: #include <bits/stdc++.h>   using namespace std;   ifstream fin( input.txt );   ofstream fout( output.txt );   const long long mod = 1000000000 + 7;   const int maxn = 500 + 10;   const int inf = 1000000000;   int n, m, par[maxn][maxn][2], dist[maxn][maxn][2];   vector<int> v[maxn], e[2];   queue<pair<pair<int, int>, int> > q;   bool mark[maxn][maxn][2];   void pr(int x, int y, int o) {     if (par[x][y][o] == -1) return;     if (o == 0) {       pr(x, par[x][y][o], 1 - o);       e[o].push_back(y);     } else {       pr(par[x][y][o], y, 1 - o);       e[o].push_back(x);     }   }   int main() {     for (int i = 0; i < maxn; i++)       for (int j = 0; j < maxn; j++) dist[i][j][0] = dist[i][j][1] = inf;     cin >> n >> m;     for (int i = 1; i <= m; i++) {       int x, y;       cin >> x >> y;       v[x].push_back(y);       v[y].push_back(x);     }     q.push(make_pair(make_pair(1, n), 0));     par[1][n][0] = -1;     mark[1][n][0] = 1;     dist[1][n][0] = 0;     while (!q.empty()) {       int x = q.front().first.first;       int y = q.front().first.second;       int o = q.front().second;       q.pop();       if (o == 0) {         for (int i = 0; i < v[x].size(); i++)           if (!mark[v[x][i]][y][1]) {             q.push(make_pair(make_pair(v[x][i], y), 1));             dist[v[x][i]][y][1] = dist[x][y][0] + 1;             mark[v[x][i]][y][1] = 1;             par[v[x][i]][y][1] = x;           }       } else {         for (int i = 0; i < v[y].size(); i++)           if (v[y][i] != x && !mark[x][v[y][i]][0]) {             q.push(make_pair(make_pair(x, v[y][i]), 0));             dist[x][v[y][i]][0] = dist[x][y][1] + 1;             mark[x][v[y][i]][0] = 1;             par[x][v[y][i]][0] = y;           }       }     }     if (dist[n][1][0] != inf) {       cout << dist[n][1][0] / 2 << endl;       pr(n, 1, 0);       cout << 1 <<    ;       for (int i = 0; i < e[1].size(); i++) cout << e[1][i] <<    ;       cout << endl << n <<    ;       for (int i = 0; i < e[0].size(); i++) cout << e[0][i] <<    ;       cout << endl;     } else       cout << -1 << endl;     return 0;   }   