include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
const int N=110,M=N*N;
int h[N],e[M],ne[M],idx;
int tt=-1,hh,q[N],d[N],n;
void add(int a,int b){
e[idx]=b;
ne[idx]=h[a];
h[a]=idx;
}
void transport(){
for(int i=1;i<=n;i){
if(d[i]==0){
q[tt]=i;
}
}
while(hh<=tt){
int i=q[hh];
for(int j=h[i];j!=-1;i=ne[i]){
int a=e[j];
d[a]–;
if(d[a]==0){
q[tt]=a;
}
}
}
}
int main(){
int son;
cin>>n;
memset(h,-1,sizeof h);
for(int i=1;i<=n;i){
while(cin>>son,son){
d[son];
add(i,son);
}
}
transport();
for(int i=0;i<n;i){
cout<<q[i]<<” “;
}
return 0;
}