5 人解决，12 人已尝试。
6 份提交通过，共有 40 份提交。
8.2 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
There are towns with their own airports in the country X. We know the maximal capacities of the airports - the airport in the town can have at most connections with other towns. The task is to design the net of air connections among the towns in such a way that the town has exactly connections with other towns. We assume that connections are two-way and that each pair of towns has at most one connection between them.
Write a program that:
We assume that for the given data a solution exists. If there exists more than one solution the program should find only one.
In the first line there is written one integer , , which is the number of towns.
In the following lines there are written positive integers (one integer in each line).
Your program should write all the connections of the created net. 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.
6 2 3 2 4 1 2
5 4 4 2 1 2 2 3 6 3 4 6 4 1