Two undirected graphs of size n are equivalent in connectivity when there is a path from u to v in one graph if and only if there is a path from u to v in the other graph for all 1≤u\<v≤n.
Given is a sequence of k graphs G_1,G_2,…,G_k. Each graph is of size n. In this sequence, for each i=2,3,…,k, there exists p_i\<i such that G_i can be obtained from G_p_i by adding or removing an edge. Divide the given graphs into groups: two graphs must be in the same group if and only if they are equivalent in connectivity.
There are multiple test cases. The first line of input contains an integer T (1≤T≤105), the number of test cases. For each test case:
The first line contains three integers k, n, and m (1≤k,n≤105, 0≤m≤min(105,2n(n−1))): the number of graphs, the number of vertices in each graph, and the number of edges in G_1.
Each of the following m lines contains two integers u and v (1≤u<v≤n), denoting an edge of G_1 connecting u and v. It is guaranteed that there are no multiple edges in G_1.
The i-th of the following k−1 lines contains an integer p_i+1, a string t_i+1, and two integers x_i+1 and y_i+1 (1≤p_i+1≤i, 1≤x_i+1\<y_i+1≤n). Each string t_i+1 is either "add" or "remove".
If t_i+1 is "add", then G_i+1 is obtained from G_p_i+1 by adding an edge connecting x_i+1 and y_i+1. It is guaranteed that this edge does not exist in G_p_i+1.
If t_i+1 is "remove", then G_i+1 is obtained from G_p_i+1 by removing an edge connecting x_i+1 and y_i+1. It is guaranteed that this edge exists in G_p_i+1.
It is guaranteed that the sum of n, the sum of m, and the sum of k in all test cases do not exceed 105.
For each test case:
On the first line, output an integer r: the number of groups.
For each group, output a single line which contains an integer k followed by k integers: the size of the group and the numbers of graphs in the group.
You can output the groups and the graphs in any order.