Problems
Farmer John is lining up his
Luckily, it might still be possible for FJ to recover the permutation that he originally wrote down. Before the sheet was stolen, Bessie recorded the sequence
Based on Bessie's information, help FJ restore the "lexicographically minimum" permutation a that could have produced b. A permutation
Input
The first line of input contains a single integer
The second line contains
Output
A single line with N space-separated integers
Example
5
4 6 7 6
3 1 5 2 4
a produces b because 3+1=4, 1+5=6, 5+2=7, and 2+4=6.