include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
const int N=510,M=510;
int n,m;
bool st[N];
int g[N][N];
void dfs(int u){
st[u]=true;
cout<<u<<” “;
for(int i=1;i<=n;i++){
if(g[u][i]&&!st[i]) dfs(i);
}
}
int main(){
cin>>n>>m;
while(m–){
int a,b;
cin>>a>>b;
g[a][b]=1;
}
/for(int i=1;i<=n;i)
{
for( int j=1;j<=n;j)
{
cout<<g[i][j]<<” “;
}
cout<<endl;
}/
cout<<endl;
for(int i=1;i<=n;i++){
if(!st[i] ) dfs(i);
}
}