Isomorphism of Tree-Cycle Graphs

We say that a directed graph G=(V, E) is a tree-cycle if and only if it fulfills the following properties:



Figure 1. An example of 4 tree-cycle graphs with 7 nodes and 9 edges. Edges of the cycle subgraphs Gc are drawn in blue. There is only one pair of isomorphic graphs: a) and d).

The task

Given a set of tree-cycle graphs with the same number of nodes and edges, identify how many mutually non-isomorphic tree-cycle graphs are contained in the set.


Input

The first line of the input is formed of three integers T, N, M separated by space. T is the number of tree-cycle graphs in the input, N is the number of nodes in each graph and M and is the number of edges in each graph. Next, there are T×M lines with pairs of integers V1, V2 representing a directed edge (V1, V2). Edges of the i-th graph are represented by lines from 1+(i−1)×M to i×M (provided the first edge of the first graph is at line 1). For each graph, the nodes are numbered from 1 to N and the edges are listed in a random.
It holds T ≤ 300, M, N ≤ 68000.

Output

Let {G1, ..., Gk} be a maximal subset of mutually non-isomorphic input graphs. Let ci be the number of input graphs isomorphic with Gi. The output contains one text line with all the numbers ci sorted in non-descending order and separated by spaces.

Example 1

Input
2 9 11
5 1
5 2
7 4
4 5
5 3
8 6
5 8
7 5
8 4
9 8
9 7
1 2
2 4
2 5
4 5
5 8
5 9
5 7
5 3
1 3
3 6
3 4
Output
2

Example 2

Input
2 9 10
1 2
1 3
2 4
4 6
6 8
3 5
5 7
7 9
2 9
9 2
1 3
3 5
6 3
5 7
7 9
1 2
2 4
4 6
6 8
3 6
Output
1 1

Example 3

Input
4 7 9
1 2
1 3
1 4
2 3
3 4
4 2
2 5
3 6
4 7
1 2
2 5
1 3
3 6
1 4
4 7
2 3
7 2
3 7
1 2
1 3
1 4
2 5
2 4
3 7
4 7
7 2
2 6
1 2
2 3
3 4
1 3
4 2
1 4
2 5
3 6
4 7
Output
1 1 2

Public data

The public data set is intended for easier debugging and approximate program correctness checking. The public data set is stored also in the upload system and each time a student submits a solution it is run on the public dataset and the program output to stdout and stderr is available to him/her.
Link to public data set