/**************************************************************** 
 * Description: 
 * Author: Alex Li
 * Date: 2024-01-25 23:07:47
 * LastEditTime: 2024-01-25 23:31:59
****************************************************************/
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int n,m;
const int N=1000;
vector<int>  e[N],tp; //e[x]存点x的邻点，tp存拓扑序列;
int din[N];   //存点的入度

bool TopoSort(){
     queue<int>  q;
     for (int i =1; i <=n; i++){
        if(din[i]==0) q.push(i);
        
     }
     while(q.size()){
        int x=q.front();
        q.pop();
        tp.push_back(x);
    for (int i = 0; i < e[x].size(); i++){
        if(--din[e[x][i]]==0)q.push(e[x][i]);
          // for (auto y:e[x]) if(--din[y]==0)q.push(y);
        }
    }
     return tp.size()==n;
     
}
int main(){
    int a,b;  //n是指结点数，m是边数
    cin>>n;
    for (int i =1; i <= n; i++){
       
   for (int  j =1; j<=n; j++){
        
        cin>>b;
        if(b==0)break;
        e[i].push_back(b);
        din[b]++;
    }

    }
    
 
    if(!TopoSort()) puts("TopoSort is not supported");
    else 
        for (int  i = 0; i <n; i++)cout<<tp[i]<<' ';
return 0;        
}