GamesAreUs.com has just completed its outside audit for this year. One item that was caught was the lack of any business rules for assigning permissions to files on the company's shared file server. The analysts are working on setting up some roles for all employees and determining what permissions should be given to each role. Your team is to review the existing situation so you can provide some input to the analysts.
Fortunately, permission assignment has not been completely random. The most common way to set up a new employee is to ask that they be set up "just like Joe", effectively making an ad-hoc prototype system.
You will be given the access control lists (ACLs) for the top-level directories of the shared file server. Using these, your team should write a program to split users into equivalence classes where all members of a class have access to exactly the same directories.
Because there are several departments in GamesAreUs.com, there are multiple sets of access control lists to be processed: one set of lists per department.
The first line of input for your program is a single integer (0 < n < 100), by itself on a line without any white space, giving the number of departments. Following that are the data for those departments.
The ACLs for one department are a sequence of ACLs ending with -1 by itself. Each ACL is a line of unsigned integers (1 \leq x \leq 2147483647) separated by a single space. The first integer in the line is the file id (FID) of the directory. The remaining integers in the line are the user ids (UIDs) who have access. Each line will have a FID and at least one UID. There will be no duplicate UIDs on a line; note that UIDs and FIDs are in separate spaces, so a UID could be the same number as a FID. The ACLs and, within an ACL, the UIDs appear in no particular order. In the complete list, a given FID will appear only once. There are at most top-level directory ACLs and at most UIDs. All FIDs and UIDs are greater than .
For each department, the first line of output identifies which case is being processed, starting with . That line contains the word Case, one space, and the integer identifying which case it is.
For every class with at least members, print a line with the number of members in the class with no sign or leading zeros, one space, and the smallest UID in the class with no sign, leading zeros, or trailing spaces. Sort the output by number of members, descending, and then by the UIDs, ascending. If there are no such classes, print no prototypes found.
Example 1