#include #define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define MOD 1000000007 //#define int long long using namespace std; typedef long long ll; const int INF = 1e9; const int MAX_V = 110; int V; vector G[MAX_V]; int match[MAX_V]; bool used[MAX_V]; //uとvを結ぶ辺をグラフに追加する void add_edge(int u, int v) { G[u].push_back(v); G[v].push_back(u); } //増加パスをDFSで探す bool dfs(int v) { used[v] = true; for (int i=0; i> N; V = N; REP(i,N) { cin >> A; REP(j,N) { if (j != A) { add_edge(i, N + j); } } } if (bipartite_matching() != N) { cout << -1 << endl; } else { REP(i,N) { cout << match[i] - N << endl; } } }