W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem [email protected].
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, zapraszamy na serwery Discord. Są one moderowane przez społeczność, ale członkowie zespołu technicznego też są tam aktywni.
On the chessboard of size () we put rooks. The arrangement of the rooks should satisfy the following rules:
Write a program which:
In the first line of the standard input there is written one positive integer , . In each of the following lines there are written four positive integers not grater than separated by single spaces. The numbers in the -th line are the coordinates of the rectangle, in which the -th rook may be put (, , and respectively).
In the standard output there should be written one word NIE, or in each of lines of the output file there should be written two integers separated by a single space. The numbers in the -th line should denote the position of -th rook (row, column). This position should be within the rectangle specified by coordinates in the -th line of the input. Pay attention to the fact that the positions of the rooks should be written in the same order as the coordinates of the rectangles were read from the input.
For the input data:
4 1 1 1 1 1 3 2 4 3 1 4 2 2 2 4 4
the correct result is:
1 1 2 3 3 2 4 4
Task author: Krzysztof Diks.