#include<bits/stdc++.h>
using namespace std;
int n,m,sx,sy,maxn=0,a[100005]={0};
vector <int> p[100005];
bool vis[100005]={};
queue <int> q;
inline int read(){
int s=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-') f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
s=s*10+ch-'0';
ch=getchar();
}
return s*f;
}
inline void write(int x){
if(x<0){
putchar('-');
x=-x;
}
if(x>9) write(x/10);
putchar(x%10+'0');
}
void bfs(int x){
q.push(x);
while(!q.empty()){
int l=q.front();
if(l>maxn) maxn=l;
q.pop();
for(int j=0;j<p[l].size();j++){
if(vis[p[l][j]]==0){
vis[p[l][j]]=1;
q.push(p[l][j]);
}
}
}
return;
}
int main(){
n=read();
m=read();
for(int i=1;i<=m;i++){
sx=read();
sy=read();
p[sx].push_back(sy);
}
for(int i=n;i>0;i--){
memset(vis,0,sizeof(vis));
vis[i]=1;
maxn=0;
bfs(i);
write(maxn);
a[i]=maxn;
cout<<" ";
}
return 0;
}