Skiing
In Olympic tournaments, ski slopes and facilities are often the most remote and widely spread out. The Vancouver Olympics followed this pattern. However, the organizers ensured that all ski facilities and the Olympic village were connected by a network of roads. Due to the distances involved, there is only one route between any two facilities (or between a facility and the Olympic village), which may pass through other facilities.
Each facility is numbered from 1 to N, with the Olympic village designated as number 1. At each facility, there is a sign displaying either «>X» or «X», indicating that «On the way from this facility to the Olympic village, you will pass through more than X other ski facilities».
One evening, after visiting a local bar, two Russian tourists debated whether it is possible to reconstruct the map of roads between the ski facilities using the information from these signs. Your task is to settle their argument.
Input
The first line contains the number N (2 ≤ N ≤ 50000). The next N-1 lines each contain a distance characteristic for the corresponding facility from the Olympic village, starting with facility 2.
0 ≤ X ≤ 100000. Note that there is no «<0» in the input data.
Output
You must output N-1 lines describing the roads between the facilities. Each line should contain two numbers from 1 to N, separated by a space, representing the facilities connected by a road. If there are multiple valid solutions, you may output any one of them. If no solution is possible, output -1.