Polyhedron#7204

Polyhedron

1 second
64 megabytes
Very hard

The surface of a polyhedron can be continuously and bijectively mapped onto a sphere. Your task is to write a program that determines the number of faces with a specific number of sides on the polyhedron.

Input

The first line contains the number of vertices, , of the polyhedron. For each from to , the ( + 1)-th line lists, in ascending order, the vertex numbers that are connected to the -th vertex by edges.

The following conditions are given:

  • The polyhedron has no more than vertices.

  • There are no more than edges.

  • Only one face has more than edges.

Output

Each line should list the vertex numbers of one face of the polyhedron. These lines should be organized in non-decreasing order based on the number of vertices in each face: starting with all -sided faces, followed by -sided faces, -sided faces, and so on.

For faces with the same number of vertices, the lists of vertex numbers i_1, i_2, i_3, … should be sorted first by i_1 in non-decreasing order, then by i_2 in non-decreasing order for constant i_1, and finally by i_3 in increasing order for constant i_1 and i_2.

Examples

Example 1

Loading
Loading