/* 5 6 1 2 1 3 3 2 3 4 2 4 2 5 1 3 2 4 5 */ #include <iostream> #include <vector> using namespace std; const int MAXN = 1000 + 10; int n, m; vector<int> G[MAXN]; int du[MAXN]; int que[MAXN]; int main() { // read cin>>n>>m; while(m--) { int a, b; cin>>a>>b; G[a].push_back(b); du[b]++; } int start=1,tail=0; for(int i=1;i<=n;i++) if(du[i]==0) que[++tail]=i; while(start<=tail) { int u=que[start++]; for(int i=0;i<(int)G[u].size();i++) { int v=G[u][i]; du[v]--; if(du[v]==0)que[++tail]=v; } } for(int i=1;i<=n;i++) cout<<que[i]<<" "; return 0; }