#include <iostream>
using namespace std;
int info[101][101];
int n;
int ans[101], ap;
struct
node
{
int ind;
int outd;
node()
{
ind =
outd = 0;
}
}soldier[101];
void
__read__()
{
cin >> n;
for( int i = 1; i <= n; i++ )
{
int x, y;
cin >> x >> y;
info[x][y] = true; // x is taller than y.
soldier[x].outd++;
soldier[y].ind++;
}
}
int
find_to_del()
{
for( int i = 1; i <= n; i++ )
if( soldier[i].ind == 0 )
return i;
return -1;
}
void
__topo__()
{
int to_del = 0;
while( ( to_del = find_to_del() ) != -1 )
{
for( int i = 1; i <= n; i++ )
if( info[to_del][i] )
{
info[to_del][i] = false;
soldier[i].ind--;
}
soldier[to_del].ind = -1;
ans[++ap] = to_del;
to_del = 0;
}
}
void
__outp__()
{
for( int i = 1; i <= n; i++ )
cout << ans[i] << " ";
cout << endl;
}
int
main()
{
__read__();
__topo__();
__outp__();
return 0;
}