During her trip, Maria saw many architectural landmarks. She was most impressed by a huge wall, made of stones. The wall was in the shape of a perfect rectangle and was made of individual stones of equal height (their widths were not necessarily equal), which were arranged in rows one above another. The count of the stones was and they were numbered with different integers from to . On each stone was written its number. Maria noticed that the stones in each row were not necessarily placed from left to right in ascending order of their numbers.
What made an even stronger impression on the girl, was that the edges formed between the stones of two adjacent rows did not coincide, i.e. the edges are not exactly one above the other. In addition, she made a list of all pairs of integers and , such that the stone with number lies on that with number . We say that a stone lies on top of another, if the first stone is positioned one row higher than the second stone and the lower side of the first stone touches the upper side of the second stone in a segment with length greater than .
Now the girl asked her father to reproduce this architectural masterpiece on a large sheet of paper, divided into unit squares, setting the following conditions:
- The count of the stones remains unchanged;
- The drawn wall should be a perfect rectangle;
- There should be no edges on two adjacent rows, which are exactly one above the other;
- The height of each stone should be one unit;
- The width of each stone, chosen by her father, can be arbitrary, but it must be an integer greater than ;
- If a stone was on top of another in the original wall, this should be the same in the reproduction;
- Also for the stones described, the lower side of the upper stone must overlap with the upper side of the lower stone on a segment of integer length greater than .
Task
Write a program that determines the dimensions of the rectangle with the smallest area, which will represent the wall, keeping the conditions set by Maria.
Input
From the first line of the standard input read two integers and - the count of the stones and the count of the pairs in the list. From each of the following M lines read two integers and , which denote that the stone with number lies on top of the stone with number . From the last line read an integer value of or . If this value is , then it is guaranteed that the numbers of the stones from left to right in each row of the original wall are in ascending order. This does not mean that you must find an arrangement of the stones with this property in the reproduction.
Output
On the first line of the standard output, print two integers and , respectively the height and the width of the rectangle with minimal area representing the wall. On each of the following lines of the output, print a description of one possible arrangement of the stones in the new wall - the -th such line should contain a single
- the count of the stones on the -th row of the wall, followed by pairs of integers, which consist of the number of the consecutive stone and its width in units. Every two consecutive numbers must be separated with a single space.
The stones must be printed by rows from the top to the bottom of the wall. If the task has many possible solutions, then print any of them.
Constraints
Scoring
The test cases are divided into groups, each of which consists of three consecutive tests. The points for each group are given only if your solution passes all three tests from the group.
In around of the groups: .
In other around of the groups: the numbers of the stones in each row of the original wall are in ascending order from left to right.
Examples
stdin
11 14
1 4
1 8
2 6
4 3
4 11
5 2
5 4
5 7
5 10
7 6
7 11
8 3
9 4
10 6
0
stdout
3 8
3 1 2 9 1 5 5
5 8 1 4 3 7 2 10 1 2 1
3 3 2 11 3 6 3
stdin
4 3
1 4
2 4
3 4
1
stdout
2 3
3 1 1 3 1 2 1
1 4 3
Explanation
The diagram shows one possible arrangement of the stones in the reproduced wall for the first example, in which a minimum area of the rectangle representing the wall is achieved, so that all set conditions are met.