#include<bits/stdc++.h>
using namespace std;
#define for1(i,a,b) for(int i=(a);i<=(b);i++)
#define for2(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long LL;
typedef pair<int,int>PII;
typedef pair<double,double>PDD;
typedef unsigned long long ULL;
typedef pair<long long,int> PLI;
const int N = 1e5+10;
int head[N],edge[N],ver[N],nxt[N];
int n,tot,m;
bool v[N];
int res;
void add(int x,int y)
{
ver[++tot]=y,nxt[tot]=head[x],head[x]=tot;
}
void dfs(int x)
{
v[x]=1;
res=max(res,x);
for(int i=head[x];i;i=nxt[i]){
int y=ver[i];
//if(v[i]) continue;
dfs(y);
}
}
int main()
{
ios::sync_with_stdio(false);
cin>>n>>m;
for1(i,1,m){
int x,y;
cin>>x>>y;
add(x,y);
}
for1(i,1,n){
//memset(v,0,sizeof v);
res=0;
dfs(i);
cout<<res<<" ";
}
return 0;
}