시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 2 2 2 100.000%

문제

Given $f_1, f_2, \ldots, f_n$, find a permutation $p_1, p_2, \ldots, p_n$ of integers $1, 2, \ldots, n$ such that, for each $i$, the length of the longest strictly increasing subsequence ending with $p_i$ is $f_i$.

입력

The first line contains an integer $n$ ($1 \leq n \leq 10^5$).

The second line contains $n$ integers $f_1, f_2, \ldots, f_n$ ($1 \leq f_i \leq n$). It is guaranteed that, for the given input, at least one such permutation $p_1, p_2, \ldots, p_n$ exists.

출력

On the first line, print $n$ integers $p_1, p_2, \ldots, p_n$. These numbers must form a permutation of integers $1, 2, \ldots, n$. If there are several possible answers, print any one of them.

예제 입력 1

7
1 1 1 1 1 1 1

예제 출력 1

7 6 5 4 3 2 1

예제 입력 2

7
1 2 3 2 4 4 3

예제 출력 2

1 3 5 2 7 6 4