func_code_string: #include <bits/stdc++.h>   using namespace std;   int ABS(int a) {     if (a < 0) return (-a);     return a;   }   vector<int> v[50005];   int main() {     int n, r1, r2, i;     scanf( %d , &n);     scanf( %d , &r1);     scanf( %d , &r2);     for (i = (1); i < (n + 1); ++i) {       if (r1 == i) continue;       int x;       scanf( %d , &x);       v[x].push_back(i);       v[i].push_back(x);     }     int parent[50005] = {0};     bool vis[50005] = {0};     queue<int> q;     q.push(r2);     parent[r2] = -1;     vis[r2] = 1;     while (!q.empty()) {       int x = q.front();       q.pop();       for (i = (0); i < (v[x].size()); ++i) {         int next = v[x][i];         if (!vis[next]) {           q.push(next);           parent[next] = x;           vis[next] = 1;         }       }     }     for (i = (1); i < (n + 1); ++i) {       if (i == r2) continue;       printf( %d  , parent[i]);     }     return 0;   }   