Polyhedron
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, n, of the polyhedron. For each j from 1 to n, the (j + 1)-th line lists, in ascending order, the vertex numbers that are connected to the j-th vertex by edges.
The following conditions are given:
The polyhedron has no more than 2000 vertices.
There are no more than 4000 edges.
Only one face has more than 8 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 3-sided faces, followed by 4-sided faces, 5-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 for constant i_1, and finally by i_3 for constant i_1 and i_2.