Peatown has become a metropolis. We can observe it as a rectangular grid of streets. There are fifty thousand vertical streets running north-south (labeled with x-coordinates from
Residents of Peatown are very irresponsible and reckless. They drive like idiots so the mayor of Peatown has decided to place traffic lights on
It is not possible to ensure that all paths are harmless, but the mayor of Peatown is satisfied if between each two traffic lights at least one of the shortest paths is harmless. Unfortunately, the current distribution of traffic lights is too dangerous. Your task is to place additional traffic lights (less than
Input Specification
The first line of input consists of an integer
Each of the following
Output Specification
Output the locations of new traffic lights, each in its own line. Placing multiple traffic lights on the same location is allowed. The number of new traffic lights must be smaller than
Sample Input 1
2
1 1
3 3
Sample Output 1
1 3
Sample Input 2
3
2 5
5 2
3 3
Sample Output 2
3 5
5 3
Sample Input 3
5
1 3
2 5
3 4
4 1
5 2
Sample Output 3
1 5
3 3
3 5
4 2
4 3
Comments