Clue

No attempts yetTime limit1sMemory limit128 MB

Problem

You may know the board game Clue, in which you combine logical clues to solve a murder mystery: you must figure out the location, the weapon, and the murderer. The candidates are:

  • Location: Ballroom, Billiard Room, Conservatory, Dining Room, Hall, Kitchen, Library, Lounge, Study
  • Weapon: Candlestick, Gun, Knife, Lead Pipe, Rope, Wrench
  • Murderer: Colonel Mustard, Miss Scarlet, Reverend Green, Mrs. Peacock, Mrs. White, Professor Plum

Each location, weapon, and suspect is printed on a card. One card of each type (location, weapon, murderer) is hidden; those three hidden cards are exactly what you must figure out. All remaining cards are dealt out completely among the $n$ players.

Players take turns asking queries. A query consists of one location, one weapon, and one suspect. When player $i$ asks a query, players $i+1, i+2, \dots, n, 1, \dots, i-1$ try, in that order, to disprove it by showing player $i$ one of the three cards in the query.

  • If a player holds at least one of the three cards, they must show one of them; if they hold several, they may choose which one to show.
  • If they hold none of the three cards, they cannot show anything and say so.

As soon as one player shows a card, the query ends immediately and the later players are not asked. In this way the players gradually learn who holds which cards and deduce the three hidden cards.

You must write a program that uses the queries and their responses to figure out as much as possible about the candidates. Assume you are player 1 and can learn only from the queries you submit yourself. Therefore the input contains only your own queries and their responses, never the queries made by other players. (In the real game you would roll dice and move around before querying, and you would also see cards shown in response to other players' queries; both are ignored here to simplify the problem.)

Every card name is written exactly as listed above, including capitalization.

Input

The first line contains the number $K$ of data sets. Then follow $K$ data sets, each of the following form.

The first line of each data set contains three integers $n, c, q$: the number of players, the number of cards you were dealt, and the number of queries. ($2 \le n \le 6$, $0 \le c \le 18$, $0 \le q \le 1000$.)

This is followed by $c$ lines, each giving the name of one card that you hold.

Then come the $q$ queries. Each query has the following form: the first line is the proposed location, the second line the weapon, and the third the suspect. This is followed by up to $n-1$ lines, the responses of the other players. Each response is either the word Nothing (if that player holds none of the three cards) or the name of the card that player shows. If a response is a card name, the query ends there and the next line begins a new query.

Every card name (your cards, the query cards, and the shown cards) is spelled exactly as in the lists above, including capitalization.

Output

For each data set, first output Data Set x: on a line by itself, where $x$ is the number of the data set. On the following lines, output the locations, weapons, and suspects that have not yet been ruled out (that is, those that could still be a hidden card), one per line. Output the three types in this order (locations, then weapons, then suspects), and within each type list the names in alphabetical order.

Separate consecutive data sets with a single blank line.