#include <iostream>
#include <vector>
#include <queue>
const int MAXN = 105;
int ind[MAXN];
std::vector<int> children[MAXN];
void topo(int n)
{
std::queue<int> q;
for(int i = 1; i <= n; i++)
{
if(ind[i] == 0)
q.push(i);
}
while(!q.empty())
{
int cur = q.front();
printf("%d ", cur);
q.pop();
int childrenCnt = children[cur].size();
for(int i = 0; i < childrenCnt; i++)
{
ind[children[cur][i]]--;
if(ind[children[cur][i]] == 0)
q.push(children[cur][i]);
}
}
}
int main()
{
int n;
int tmp;
scanf("%d", &n);
for(int i = 1; i <= n; i++)
{
while(1)
{
scanf("%d", &tmp);
if(tmp == 0)
break;
children[i].push_back(tmp);
ind[tmp]++;
}
}
topo(n);
printf("\n");
return 0;
}