|
|||||||||||||||
|
Airports
There are n towns with their own airports in the country X. We know the maximal capacities of the airports - the airport in the town Mi can have at most di connections with other towns. The task is to design the net of air connections among the towns in such a way that the town Mi has exactly di connections with other towns. We assume that connections are two-way and that each pair of towns has at most one connection between them.
TaskWrite a program that:
InputIn the first line of the text file LOT.IN there is written one integer n, 3 <= n <= 500, which is the number of towns.In the following n lines there are written positive integers di (one integer in each line).
OutputYour program should write all the connections of the created net to the text file LOT.OUT. The description of each connection consists of two positive integers separated by a single space. These integers are the numbers of two connected towns. Each description should be placed in a separate line. The numbers of towns in a line can be written in an arbitrary order. Similarly, the order of connections is not important.
ExampleFor the file:6 2 3 2 4 1 2an example of a correct solution is the file LOT.OUT 5 4 4 2 1 2 2 3 6 3 4 6 4 1 |