#include #include #define nmax 1005 using namespace std; vector v[nmax]; vector > sol; int n, m, x, y, pre[nmax]; bool seen[nmax]; void dfs(int x) { seen[x] = true; for(int i=0; i>n>>m; for(int i=1; i<=m; i++) { cin>>x>>y; v[x].push_back(y); } for(int i=1; i<=n; i++) if(!seen[i]) dfs(i); cout<