시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
3 초 1024 MB 0 0 0 0.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:

  • For every i (1 ≤ i ≤ N), there exists j (1 ≤ j ≤ K) such that both Li ≤ xj ≤ Ri and Di ≤ yj ≤ Ui hold.
  • For every j (1 ≤ j ≤ K), both 1 ≤ xj ≤ 1 000 000 000 and 1 ≤ yj ≤ 1 000 000 000 hold.

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.

제한

  • 1 ≤ N ≤ 200 000.
  • 1 ≤ K ≤ 4.
  • 1 ≤ Li ≤ Ri ≤ 1 000 000 000 (1 ≤ i ≤ N).
  • 1 ≤ Di ≤ Ui ≤ 1 000 000 000 (1 ≤ i ≤ N).
  • There exists a tuple of K cells satisfying the conditions in the problem statement.

예제 입력 1

4 2
2 1 3 3
1 2 4 3
6 1 7 4
5 3 7 5

예제 출력 1

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).

예제 입력 2

3 3
1 1 1 1
1 2 1 2
1 3 1 3

예제 출력 2

1 1
1 2
1 3