#include using namespace std; const int MAX_V = 100; int V; vector G[MAX_V]; int match[MAX_V]; bool used[MAX_V]; void add_edge(int u, int v) { G[u].push_back(v); G[v].push_back(u); } bool dfs(int v) { used[v] = true; for (int i = 0; i < G[v].size(); i++) { int u = G[v][i], w = match[u]; if (w < 0 || !used[w] && dfs(w)) { match[v] = u; match[u] = v; return true; } } return false; } int bipartite_matching() { int res = 0; memset(match, -1, sizeof(match)); for (int v = 0; v < V; v++) { if (match[v] < 0) { memset(used, 0, sizeof(used)); if (dfs(v)) res++; } } return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; V = 2 * n; for (int i = 0; i < n; i++) { int a; cin >> a; for (int j = 0; j < n; j++) { if (j == a) continue; add_edge(i, n + j); } } if (bipartite_matching() != n) { cout << -1 << endl; } else { for (int i = 0; i < n; i++) { cout << match[i] - n << endl; } } return 0; }