시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 256 MB111100.000%

## 문제

There are $n$ people at the round gaming table. Each of them has a set of cards. Every card contains some number $x$. Players make turns consecutively, one after another, starting from the player number 1. A player in his turn can either skip his turn (to pass), or put (and leave on the table) a card with a number that is strictly greater than the previously played last number. No more than $k$ players in a row can pass the turn. All players know the numbers written on the other players cards and always play optimally. Help gamblers to assemble an increasing sequence of maximum length.

## 입력

The first line contains two numbers $n$ and $k$ --- the number of players and the maximum possible amount of turn skipping in a row.

The next $n$ lines contain the description of the cards players have in their hands. The first number in the $m_i$ is the number of cards the current player has in his hand. The following space separated $m_i$ numbers represent the written on the cards numbers $x$.

## 출력

In the first line print the single number --- the length of the maximum sequence. In the next lines print two space separated numbers: the player index number and the number written on the card he played. If several solutions exist, output any of them.

## 제한

• $0 \le \sum m_i \le 10^5$
• $1 \le n \le 10^5$
• $0 \le k < n$
• $0 \le x \le 10^9$

## 예제 입력 1

3 1
4 1 10 12 20
2 11 21
4 3 5 15 22


## 예제 출력 1

9
1 1
3 3
1 10
2 11
1 12
3 15
1 20
2 21
3 22