The government of Berland decided to build a high-speed rail system in the country. Berland has cities numbered with positive integers from to . It is planned to connect some pairs of cities with high speed railways. Each of the roads will be able to move in both directions between the cities that it connects.
High speed railways are the future, so it is necessary that, using railways, one can get from any city to any other. In order to save money, it was decided to build the minimum number of roads necessary to fulfill this condition.
The government of the -th city is ready to serve exactly d_i trains that will go to other cities. Therefore, the number of railways leaving the -th city must be equal to d_i. Fortunately, it turned out that d_1 + d_2 + \ldots + d_n = 2n - 2.
The government wants residents to be able to move between cities with as few transfers as possible. It is necessary to make such a plan of the railway system so that the maximum number of changes that must be made to get from one city to another is as small as possible.
The first line contains an integer - the number of cities in Berland (2 \leq n \leq 200\,000). The next line contains integers d_1, d_2, \ldots, d_n (1 \leq d_i < n). The number of cities connected to the -th city by railroad must be the same as d_i for any city . It is guaranteed that d_1 + d_2 + \ldots + d_n = 2n - 2.
Print n - 1 lines - the description of the railways in the optimal plan. Each line must contain two integers s_i and f_i - the numbers of cities that need to be connected by a railway. The conditions 1 \leq s_i, f_i \leq n, s_i \neq f_i must be satisfied.
The number of cities connected to the -th city by the railroad must be the same as d_i for any city . The maximum number of transfers required to get from one city to another should be as small as possible. If there are several possible optimal plans for the construction of railways, you can print any of them. It is guaranteed that there is a plan that meets all the conditions.
Example 1
Example 2
In the first test case, the answer is this plan:

You can see that from any city you can get to any other using the railways. Also, each city is connected by rail to the required number of cities. For example, city is connected to three cities: , and (d_1 = 3).
The maximum number of changes required to get from one city to another is reached, for example, for cities and , for this you need to use transfers. First you need to get from the city to the city , then from the city to the city , then from the city to the city and finally from city to city . It is impossible to build a plan in which the maximum number of transfers is less.