//
// main.cpp
// ceshi
//
// Created by 戴之阳 on 2016/11/.
// Copyright © 2016年 sky.dai. All rights reserved.
//
//
// main.cpp
// ceshi
//
// Created by 戴之阳 on 2016/11/14.
// Copyright © 2016年 sky.dai. All rights reserved.
// 拓扑排序
// 基于dfs和kahn
/*DFS
L ← Empty list that will contain the sorted nodes
S ← Set of all nodes with no outgoing edges
for each node n in S
do
visit(n)
function visit(node n)
if n has not been visited yet then
mark n as visited
for each node m with an edge from m to n
do
visit(m)
add n to L*/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <list>
#include <stack>
#include <cstring>
#include <cstdio>
using namespace std;
int n;
int graph[102][102];
bool visited[102];
vector<int>result;
void initial()
{
memset(graph,0,sizeof(graph));
memset(visited,false,sizeof(visited));
result.clear();
}
void dfs(int start)
{
visited[start] = true;
for(int j=1;j<=n;j++)
if(start!=j && graph[start][j]==1 && !visited[j])
dfs(j);
result.push_back(start);
}
int main()
{
int precedence_relations;
while(scanf("%d %d",&n,&precedence_relations) && n && precedence_relations)
{
initial();
int x,y;
for(int i=0;i<precedence_relations;i++)
{
scanf("%d %d",&x,&y);
graph[x][y]=1; //构建有向无环图
}
//input
for(int i=1;i<=n;i++)
if(visited[i]==false)
dfs(i);
//dfs遍历每个未被访问的节点
int temp = result.size()-1;
printf("%d",result[temp]);
for(int i=temp-1;i>=0;i--)
printf(" %d",result[i]);
printf("\n");
//output
}
return 0;
}