Buffalo Hunting
Shaman of the hunt, Alkstimynl, along with his n loyal archers, has spotted a herd of n buffalo on the prairie. Each archer expressed which buffalo they most desired to shoot.
After gathering their preferences, Alkstimynl devised a plan: each archer must shoot one buffalo, each buffalo must be shot by exactly one archer, and no archer can shoot the buffalo they initially chose.
Your task is to determine a shooting order that satisfies these conditions, or to inform Alkstimynl that such an order is impossible.
Input
The first line of the input contains a natural number n (1 ≤ n ≤ 100000), representing the number of archers in Alkstimynl's squad.
The second line contains n natural numbers ranging from 1 to n, indicating the buffalo each archer, from the 1-st to the n-th, initially chose.
Output
If it is impossible to assign the buffalo according to the rules, output -1. Otherwise, provide any valid order in which the 1-st, 2-nd, ..., n-th archer should shoot the buffalo.