func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:1108864220 )   using namespace std;   const int MOD = 1000000007;   const int INF = 1000000000;   const double EPS = 1e-9;   const int HASH_POW = 29;   const long double PI = acos(-1.0);   mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());   long long nextLong(long long l, long long r) {     uniform_int_distribution<long long> foo(l, r);     return foo(rnd);   }   double nextDouble(double l, double r) {     uniform_real_distribution<double> foo(l, r);     return foo(rnd);   }   double workTime() { return double(clock()) / CLOCKS_PER_SEC; }   void myReturn(int code = 0) { exit(code); }   int n, p[100010], depth[100010];   vector<int> G[100010];   vector<int> order, oper;   bool compare(int u, int v) { return depth[u] < depth[v]; }   void dfs(int v) {     depth[v] = 0;     for (auto to : G[v]) {       dfs(to);       depth[v] = max(depth[v], depth[to] + 1);     }     sort(G[v].begin(), G[v].end(), compare);   }   void getOrder(int v) {     order.push_back(v);     for (auto to : G[v]) {       getOrder(to);     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     scanf( %d , &n);     for (int i = 1; i < n; ++i) {       scanf( %d , &p[i]);       G[p[i]].push_back(i);     }     dfs(0);     getOrder(0);     for (int i = 1; i < n; ++i) {       int v = order[i], par = order[i - 1];       while (par != p[v]) {         oper.push_back(v);         par = p[par];       }     }     for (auto i : order) {       printf( %d  , i);     }     printf(  n%d n , oper.size());     for (auto i : oper) {       printf( %d  , i);     }     myReturn();   }   