func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 10;   vector<int> g[N];   int c[N], val[N], ans[N];   void merge(vector<int> &vc, vector<int> &tmp) {     for (auto u : tmp) vc.push_back(u);   }   vector<int> dfs(int u) {     vector<int> vc, tmp;     for (auto v : g[u]) {       tmp = dfs(v);       merge(vc, tmp);     }     if (c[u] > vc.size()) {       printf( NO n );       exit(0);     }     vc.insert(vc.begin() + c[u], u);     return vc;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1, u; i <= n; i++) {       val[i] = 1;       scanf( %d%d , &u, &c[i]);       g[u].push_back(i);     }     vector<int> vc = dfs(0);     for (int i = 0; i < vc.size(); i++) {       ans[vc[i]] = i + 1;     }     printf( YES n );     for (int i = 1; i <= n; i++) printf( %d  , ans[i]);     return 0;   }   