func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using cd = complex<double>;   const int max_n = 200500;   vector<int> g[max_n];   vector<int> og[max_n];   vector<int> used(max_n);   bool find_cycles(int x) {     used[x] = 1;     for (int i : g[x]) {       if (used[i] == 1) {         return true;       }       if (!used[i] && find_cycles(i)) {         return true;       }     }     used[x] = 2;     return false;   }   vector<int> ts;   void top_sort(int x) {     used[x] = 1;     for (int i : g[x]) {       if (!used[i]) {         top_sort(i);       }     }     ts.push_back(x);   }   vector<int> dp1(max_n);   void calc_dp1(int x) {     used[x] = 1;     dp1[x] = x;     for (int i : og[x]) {       if (!used[i]) {         calc_dp1(i);       }       dp1[x] = min(dp1[x], dp1[i]);     }   }   vector<int> dp2(max_n);   void calc_dp2(int x) {     used[x] = 1;     dp2[x] = x;     for (int i : g[x]) {       if (!used[i]) {         calc_dp2(i);       }       dp2[x] = min(dp2[x], dp2[i]);     }   }   int main() {     cout.precision(20);     cout << fixed;     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, m;     cin >> n >> m;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       g[a].push_back(b);       og[b].push_back(a);     }     for (int i = 1; i <= n; i++) {       if (!used[i]) {         if (find_cycles(i)) {           cout << -1;           return 0;         }       }     }     fill(used.begin(), used.end(), 0);     for (int i = 1; i <= n; i++) {       if (!used[i]) {         top_sort(i);       }     }     reverse(ts.begin(), ts.end());     fill(used.begin(), used.end(), 0);     for (int i = 0; i < n; i++) {       if (!used[ts[i]]) {         calc_dp1(ts[i]);       }     }     fill(used.begin(), used.end(), 0);     for (int i = 0; i < n; i++) {       if (!used[ts[i]]) {         calc_dp2(ts[i]);       }     }     int cnt = 0;     for (int i = 1; i <= n; i++) {       cnt += dp1[i] == i && dp2[i] == i;     }     cout << cnt <<   n ;     for (int i = 1; i <= n; i++) {       cout << (dp1[i] == i && dp2[i] == i ?  A  :  E );     }   }   