#include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) typedef long long ll; int constexpr MAX_V = 55; vector G[MAX_V]; int used[MAX_V]; int match[MAX_V]; int N; bool find_augment_path(int v) { used[v] = 1; for(int u: G[v]) { int w = match[u]; if(w < 0 || (!used[w] && find_augment_path(w))) { match[v] = u; match[u] = v; return true; } } return false; } int bipartite_matching() { memset(match, -1, sizeof match); int ret = 0; rep(i, N) { memset(used, 0, sizeof used); if(find_augment_path(i)) { ret ++; } } return ret; } int main() { cin >> N; rep(i, N) { int denial; cin >> denial; rep(j, N) { if(j != denial) { G[i].push_back(N+j); G[N+j].push_back(i); } } } if(bipartite_matching() != N) { cout << -1 << endl; } else { rep(i, N) { cout << match[i]-N << endl; } } return 0; }