

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
が 回ずつ現れる長さ の数列を「長さ の順列」と呼びます。
長さ の順列 が与えられるので、以下の条件を満たす長さ の順列 を出力してください。
- 全ての に対して の 番目の要素が である。
ただし、条件を満たす は必ずただ つ存在することが証明できます。
制約
- は長さ の順列である。
- 入力は全て整数である。
入力
入力は以下の形式で標準入力から与えられる。
出力
数列 を空白区切りで 行で出力せよ。
入力例 1Copy
3 2 3 1
出力例 1Copy
3 1 2
以下に説明する通り、 は条件を満たす順列です。
- のとき
- のとき
- のとき
入力例 2Copy
3 1 2 3
出力例 2Copy
1 2 3
全ての に対して が成り立つときは になります。
入力例 3Copy
5 5 3 2 4 1
出力例 3Copy
5 3 2 4 1
Score : points
Problem Statement
We will call a sequence of length where each of occurs once as a permutation of length .
Given a permutation of length , , print a permutation of length , , that satisfies the following condition.
- For every , the -th element of is .
It can be proved that there exists a unique that satisfies the condition.
Constraints
- is a permutation of length (defined in Problem Statement).
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the sequence in one line, with spaces in between.
Sample Input 1Copy
3 2 3 1
Sample Output 1Copy
3 1 2
The permutation satisfies the condition, as follows.
- For , we have .
- For , we have .
- For , we have .
Sample Input 2Copy
3 1 2 3
Sample Output 2Copy
1 2 3
If for every , we will have .
Sample Input 3Copy
5 5 3 2 4 1
Sample Output 3Copy
5 3 2 4 1