Problem B: Inviting Politicians |
The president requests you to help him in solving the problem.
The first line of the input contains an integer
indicating the
number of test cases to follow.
The first line of each test case contains two
integers
and
.
Each of the next N lines contains
the name of a politician. No name will be more than 10 characters long and
will not contain any whitespace character. Each of the next M lines contains
the name of two politicians (both of which are valid names occurring in the
nameslist given at the beginning of the test case) who are not in good terms
with each other and hence can not be placed in the same group.
For each test case in the input first output the test case number (starting from 1) as shown in the sample output. Then for each i(= 1, 2, 3, 4) print an integer Pi on line 2i indicating the number of politicians to be invited on day i, and on line 2i + 1 print the names of those politicians with every two consecutive names separated by a single whitespace character. Assume that the politicians can always be invited in 4 days and can never be invited in less than 4 days. Note that the solution is not unique and hence any valid solution is acceptable.
Print a blank line between two consecutive test cases.
2 4 6 A B C D A B A C A D B C B D C D 6 7 A B C D E F A B A C A D B C B D C D D E
Case #1 1 A 1 B 1 C 1 D Case #2 2 A E 1 B 1 C 2 D F