Going to Raptors Games Disclaimer: The following story is not about any of the coaches! I have 2 season tickets for the Toronto Raptors. Given the way they are playing, none of my children would go with me! So I decided to check if my friends on a popular social network (that shall remain unnamed) would like to go with me. I made a post for each of the games I have tickets to and then recorded which people clicked "like" against each game. Obviously any friend could like any number of games and you cannot "like" a game twice. I have 50 friends and there are 45 pairs of tickets (42 regular season games and 3 exhibition games). Your problem is to solve the following problem -- given a set of friends, list the number of games each would like to go to and output the games they like. Keep in mind that although I can only take one friend, more than one of them might like to go to a game (I expect more than one might want to go to "greet" Chris Bosh when the Miami Heat are here). Input ----- The first line is of input is a number n, denoting the number of friend-game pairs I recorded. The next n lines each have a friend-game pair. Friends are numbered 1 through 50 and games 1 through 45. The next line contains a number m denoting the number of queries. The next m lines each contain a number k of friends followed by a set of k friends. Output ------ For each set of friends given, output the number of games each friend likes and a sorted list (in increasing order) of all games that they are interested in (see the sample input for the precise format). Sample Input ------------ 3 1 23 1 24 44 3 1 3 1 2 3 Sample output ------------- Set 1: 2 0 0 23 24