Buffalo Hunting#4329

Buffalo Hunting

2 seconds
256 megabytes
Easy

Shaman of the hunt, Ostap, along with his loyal archers, has spotted a herd of buffalo on the prairie. Each archer expressed which buffalo they most desired to shoot.

After gathering their preferences, Ostap 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 Ostap that such an order is impossible.

Input

The first line of the input contains a natural number (1 \leq n \leq 100000), representing the number of archers in Ostap's squad.

The second line contains natural numbers ranging from to , indicating the buffalo each archer, from the -st to the -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 -st, -nd, , -th archer should shoot the buffalo.

Examples

Example 1

Loading
Loading