#GSP1. Dictionary order

Dictionary order

English version:

We have n characters in alphabetical table and n circle permutations. They (permutation) need to be
ascendingly sorted in dictionary order. If same dictionary orders are found in 2 permutations, higher prioty
belongs to one having lower starting character 's index (in input given).

Input:
+) First line contains n (1<= n <= 5 * 10^4).
+) n following lines: ith line is writen a_i (1 <= a_i <= 2^31), ith character 's order in alphabetical table.
Output: write n lines with n indexs after sorting, respectively.
Example:
Data:
5
2
1
1
2
4
Result:
2
3
1
4
5

Don't forget your program 's size!
S_have fun! :)

Vietnamese Version:
Cho n kí tự trong bảng kí tự. Xét n hoán vị vòng quanh. Sắp xếp chúng theo thứ tự từ điển tăng dần.
Nếu 2 hoán vị có cùng thứ tự từ điển thì ưu tiên hoán vị có chỉ số của kí tự bắt đầu nhỏ hơn xếp trước.

Input:
+) Dòng đầu ghi số n (1<= n <= 5 * 10 ^ 4)` .
+) N dòng sau: dòng thứ i ghi a_i (1 <= a_i <= 2^31) là thứ tự của kí tự thứ i trong bảng chữ cái.
Output: ghi ra n dòng là n chỉ số tương ứng sau khi sắp xếp.
Ví dụ
Dữ liệu:
5
2
1
1
2
4
Kết qủa
2
3
1
4
5