func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int N = 1e6 + 66;   vector<int> g[N], f[N];   int used[N];   vector<int> topsort;   void dfs(int v) {     used[v] = 1;     for (int to : g[v])       if (used[to] != 1) dfs(to);     topsort.emplace_back(v);   }   int c[N];   void color(int v) {     if (false) cerr << v <<   color n ;     if (c[v] == 0) c[v] = v;     used[v] = 2;     for (int to : f[v])       if (used[to] != 2) c[to] = c[v], color(to);   }   int S;   vector<int> newg[N];   void fnd(int v) {     if (false) cerr << v <<   fnd n ;     used[v] = 3;     for (int to : newg[v])       if (used[to] != 3) fnd(to);     if (S == -1) S = v;   }   void clr(int v) {     used[v] = 4;     for (int to : g[v])       if (used[to] != 4) clr(to);   }   void solve() {     int n, m;     cin >> n >> m;     topsort.clear();     for (int i = 1; i <= n; ++i) {       used[i] = 0;       g[i].clear();       f[i].clear();       newg[i].clear();       c[i] = 0;     }     for (int i = 1; i <= m; ++i) {       int a, b;       cin >> a >> b;       g[a].emplace_back(b);       f[b].emplace_back(a);     }     for (int i = 1; i <= n; ++i) {       if (!used[i]) {         dfs(i);       }     }     reverse(topsort.begin(), topsort.end());     for (int i : topsort) {       if (used[i] != 2) {         color(i);       }     }     for (int i = 1; i <= n; ++i) {       if (false) cerr << c[i] <<    n [i == n];       for (int j : g[i]) {         newg[c[i]].emplace_back(c[j]);       }     }     S = -1, fnd(c[1]);     clr(S);     if (false) cerr << S <<   S n ;     vector<int> j, p;     for (int i = 1; i <= n; ++i) {       if (used[i] != 4)         p.emplace_back(i);       else         j.emplace_back(i);     }     assert(!j.empty());     if (p.empty()) {       cout <<  No n ;     } else {       cout <<  Yes n  << j.size() <<     << p.size() <<   n ;       for (int i : j) cout << i <<    ;       cout <<   n ;       for (int i : p) cout << i <<    ;       cout <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);     int TT;     cin >> TT;     while (TT--) solve();   }   