$n=<>; @a=<>; hoge:for$i(0..$n-1){ for$j(0..$n-1){ $a[$j]!=($i+$j)%$n or next hoge; } for$j(0..$n-1){ print+($i+$j)%$n,$/; } exit; } print -1;