|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|3 초||1024 MB||12||3||3||100.000%|
Have you ever heard of Just Odd Inventions, Ltd.? This company is known for their “just odd inventions.” We call it JOI, Ltd. in this problem.
A new year party is being held in JOI, Ltd. The staff is baking N hamburg steaks on a huge wire mesh. We consider the wire mesh as a 1 000 000 000 × 1 000 000 000 grid. We denote by (x, y) the cell in the x-th column from the left and the y-th row from the bottom (1 ≤ x ≤ 1 000 000 000, 1 ≤ y ≤ 1 000 000 000)
Hamburg steaks are numbered from 1 to N. The Hamburg steak i (1 ≤ i ≤ N) is place on the rectangular area whose left-bottom vertex is (Li, Di) and right-top vertex is (Ri, Ui). It is possible that the Hamburg steaks overlaps.
You are a new employee of JOI, Ltd. Your task is to choose K cells on the wire mesh and stick bamboo skewers at the center of the cells perpendicularly to the wire mesh. For each hamburg steak, you can confirm how it is cooked by sticking at least one bamboo skewer at a cell on it. You need to confirm all the hamburg steaks. You are allowed to stick more than one bamboo skewer at a cell. You are also allowed to stick a bamboo skewer at a cell where no hamburg steak exists.
Formally, your task is to find a tuple of (not necessarily distinct) K pairs of integers (x1, y1), . . . , (xK, yK) satisfying the following condition:
Write a program which, given the positions of the hamburg steaks and the number of bamboo skewers, calculates one way to stick the bamboo skewers. For the input data given for this task, it is guaranteed that there exists a tuple of cells satisfying the above conditions.
Read the following data from the standard input. All the values in the input are integers.
N K L1 D1 R1 U1 L2 D2 R2 U2 . . . LN DN RN UN
Write K lines to the standard output. In the j-th line (1 ≤ j ≤ K), output xj and yj, separating them by a space.
If there are more than one way to stick the bamboo skewers satisfying the conditions, output any of them.
4 2 2 1 3 3 1 2 4 3 6 1 7 4 5 3 7 5
2 2 7 4
By sticking a bamboo skewer at the cell (2, 2), you can confirm how the hamburg steaks 1 and 2 are cooked, and by sticking a bamboo skewer at the cell (7, 4), you can confirm how the hamburg steaks 3 and 4 are cooked.
Other than the cells (2, 2) and (7, 4), You can stick bamboo skewers, for example, at the cells (3, 3) and (6, 4).
3 3 1 1 1 1 1 2 1 2 1 3 1 3
1 1 1 2 1 3