#include<iostream> #include<cstring> #include<queue> using namespace std; int mapp[505][505],vis[1000],a[505]; int main() { int n,m,cont,x,y; while(cin>>n>>m) { if(n==1) { cout<<n<<endl; continue; } priority_queue<int,vector<int>,greater<int> > que; memset(mapp,0,sizeof(mapp)); memset(vis,0,sizeof(vis)); for(int i=1;i<=m;i++) { cin>>x>>y; if(mapp[x][y]==0) vis[y]++; mapp[x][y]=1; } for(int i=1;i<=n;i++) { if(vis[i]==0) { que.push(i); } } cont=0; while(!que.empty()) { int tot=que.top(); a[++cont]=tot; que.pop(); for(int i=1;i<=n;i++) { if(mapp[tot][i]) { mapp[tot][i]=0; vis[i]--; if(vis[i]==0) { que.push(i); } } } } for(int i=1;i<cont;i++) cout<<a[i]<<" "; cout<<a[cont]<<endl; } }