func_code_string: #include <bits/stdc++.h>   using namespace std;   const long double pi = 3.14159265359;   const int N = 1e5 + 5;   const int MOD = 1e9 + 7;   int c[N];   vector<int> ans;   vector<int> g[N];   int main() {     ios_base::sync_with_stdio(0);     cout.tie(0);     cin.tie(0);     ;     int n;     cin >> n;     int r, p;     for (int i = 0; i < n; ++i) {       cin >> p >> c[i];       --p;       if (p == -2) {         r = i;         continue;       }       c[i] = !c[i];       g[p].push_back(i);     }     for (int i = 0; i < n; ++i) {       if (c[i] || i == r) continue;       bool gd = false;       for (auto &it : g[i]) {         if (c[it]) {           gd = true;           break;         }       }       if (!gd) ans.push_back(i);     }     if (ans.empty())       cout << -1;     else {       for (auto &it : ans) {         cout << it + 1 <<    ;       }     }     return 0;   }   