ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

1809. Chapaev and Potatoes

Time limit: 0.5 second
Memory limit: 64 MB
Anka and Petka were waiting for Chapaev and eating potatoes. Soon they were full and decided to play the “Chapaev” game using the remaining four potatoes.
Petka took a 20 × 20 board, put the potatoes on it, and declared the following rules. No two potatoes could lie on the same square, and a player could shoot at a potato and knock it off the board with another potato only if the potatoes were in the same vertical or horizontal line and there were no other potatoes between them.
Anka suggested to take some potatoes and put them on unoccupied squares of the board so that each potato could be used to shoot at exactly one another potato. Help Petka do this by changing the positions of as few potatoes as possible.


The four input lines contain the coordinates xi, yi of the potatoes. The coordinates are integers in the range from 1 to 20. No two potatoes are on the same square.


Output the new coordinates of the potatoes. The potatoes must be described in the same order as in the input. If there are several answers, output any of them.


1 1
2 2
4 4
4 3
1 2
2 2
4 4
4 3
Problem Author: Dmitry Ivankov
Problem Source: NEERC 2010, Eastern subregional contest