func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5;   bool vis[N];   int n, m, ans;   vector<int> top;   vector<pair<int, int> > adj[N];   void dfs(int u) {     vis[u] = 1;     for (int i = 0; i < adj[u].size(); i++) {       int v = adj[u][i].first;       if (!vis[v]) dfs(v);     }     top.push_back(u);   }   int main() {     cin >> n >> m;     for (int i = 1; i <= m; i++) {       int u, v;       cin >> u >> v;       adj[u].push_back({v, i});     }     for (int i = 1; i <= n; i++)       if (!vis[i]) dfs(i);     for (int i = n - 1; i > 0; i--) {       int u = top[i], v = top[i - 1], j = 0;       for (j = 0; j < adj[u].size(); j++) {         if (adj[u][j].first == v) {           ans = max(adj[u][j].second, ans);           break;         }       }       if (j == adj[u].size()) {         cout <<  -1 n ;         return 0;       }     }     cout << ans << endl;     return 0;   }   