Investigation#11537

Investigation

1 Sekunde
256 Megabyte
Schwer

"Chelix" studies at BSUIR, where he was given an assignment to do a laboratory work on the academic subject "physics". He was too lazy to do this work himself, so he decided to borrow it from his classmates. While checking this paper, the teacher suspected something wrong and decided to call in an investigator. The investigator decided to take the case. He was given a lab paper of size n \times m. It was broken down into suspicious rectangles. To verify that this work was copied, the investigator must restore the original work from what the instructor gave to him. To do this, he can use his two tricks:

  1. Cut the current rectangle horizontally or vertically between any two integer row or column numbers, respectively.

  2. Transition to a rectangle with a different number.

But the investigator realized that this task is very difficult for him, and he decided to ask for your help.

In order for you to do it, he explained how to number the rectangles:

The lab work should be cut according to the plan that the investigator has designed especially for you, namely, he has given you a table of rows and columns, the same pair of numbers in which means that those two cells should be placed in the same rectangle after all the cuts, and there should be no cells with different numbers in that rectangle.

The techniques to be performed must be written down in a specific format:

To make the investigation not very long, the investigator has asked you to tackle it in 10^6 moves.

Eingabe

In the first line you are given the numbers and m~(1 \le n, m \le 100)  — the number of rows and columns, respectively.

The next rows each contain numbers a_{i,j}~(1 \le a_{i,j} \le n \cdot m)  — plan that the investigator developed.

Ausgabe

In the first line print one integer q~(0 \le q \le 10^6)  — the number of techniques you have performed.

On the next lines, print the descriptions of techniques according to the format described above.

The answer is guaranteed to exist.

Beispiele

Beispiel 1

Loading
Loading