func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<vector<int>> g, rv;   int ds[3030][3030];   vector<int> md[3030];   int rd[3030][3030];   vector<int> mr[3030];   int main() {     int n, m;     scanf( %d %d  , &n, &m);     g.assign(n, vector<int>());     rv.assign(n, vector<int>());     while (m--) {       int a, b;       scanf( %d %d  , &a, &b);       a--;       b--;       if (a == b) continue;       g[a].push_back(b);       rv[b].push_back(a);     }     memset(ds, -1, sizeof(ds));     memset(rd, -1, sizeof(rd));     for (int i = 0; i < n; i++) {       ds[i][i] = rd[i][i] = 0;       queue<int> q;       priority_queue<pair<int, int>, vector<pair<int, int>>,                      greater<pair<int, int>>>           pq;       q.push(i);       while (!q.empty()) {         int u = q.front();         q.pop();         if (i != u) pq.push({ds[i][u], u});         while (pq.size() > 3) {           pq.pop();         }         for (int j = 0; j < g[u].size(); j++) {           int v = g[u][j];           if (ds[i][v] >= 0) {             continue;           }           ds[i][v] = ds[i][u] + 1;           q.push(v);         }       }       while (!pq.empty()) {         int u = pq.top().second;         pq.pop();         md[i].push_back(u);       }       q = queue<int>();       q.push(i);       while (!q.empty()) {         int u = q.front();         q.pop();         if (i != u) pq.push({rd[i][u], u});         while (pq.size() > 3) {           pq.pop();         }         for (int j = 0; j < rv[u].size(); j++) {           int v = rv[u][j];           if (rd[i][v] >= 0) continue;           rd[i][v] = rd[i][u] + 1;           q.push(v);         }       }       while (!pq.empty()) {         int u = pq.top().second;         pq.pop();         mr[i].push_back(u);       }     }     int ma = 0;     int mi[4];     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (i == j) continue;         if (ds[i][j] < 0) continue;         for (int k = 0; k < mr[i].size(); k++) {           for (int l = 0; l < md[j].size(); l++) {             int a = mr[i][k], b = md[j][l];             if (a == b || a == j) continue;             if (b == i) continue;             int dist = ds[a][i] + ds[i][j] + ds[j][b];             if (dist > ma) {               ma = dist;               mi[0] = a;               mi[1] = i;               mi[2] = j;               mi[3] = b;             }           }         }       }     }     printf( %d %d %d %d n , mi[0] + 1, mi[1] + 1, mi[2] + 1, mi[3] + 1);   }   