#c22104. 排序5

排序5

Sorting 5

Problem Description

Given nn positive integers a1,a2,…,ana_1, a_2, \dots, a_n, sort them from small to large and output them. Also output the rank of each original number after sorting (for equal numbers, the one with the smaller original index comes first).

Input Format

The first line is an integer nn, the number of values.

The next line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n.

Output Format

The first line contains nn integers: the sorted result.

The second line contains nn integers: the rank of each original number after sorting.

Sample Input

5
3 9 5 3 2

Sample Output

2 3 3 5 9
2 5 4 3 1

Constraints

For 100%100\% of the data, 1≤n≤1051 \le n \le 10^5 and 1≤ai≤1051 \le a_i \le 10^5.