Pizza Hawaii

Time limit1sMemory limit128 MB

Problem

You are travelling in a foreign country. Although you are happy to try the local food, you cannot resist stopping when you find an Italian restaurant that serves pizza. Unfortunately the menu is written in the local language, so the lists of pizza ingredients mean nothing to you. What can you do?

The one thing you notice is that each pizza has an Italian name that sounds familiar, and for each of those names you remember which ingredients that pizza usually has. You want to use that knowledge to work out what each word in the ingredient lists might mean.

Input

The first line of input contains the number of test cases t (0 < t ≤ 20).

Each test case begins with a line containing the number n of pizzas on the menu (1 ≤ n ≤ 60). The next 3·n lines describe those pizzas. Each pizza is described by three lines:

  • The first line is the name of the pizza, made of between 3 and 20 uppercase and lowercase letters.
  • The second line starts with an integer mi, the number of ingredients of the pizza on the menu (1 ≤ mi ≤ 20), followed by the mi ingredients separated by spaces. Each ingredient is a word of between 2 and 20 lowercase letters.
  • The third line gives, in the same format, the ingredients you remember for that pizza in your native language.

The number of ingredients on the two lines may differ, because a restaurant may use slightly different ingredients for a pizza of a given name, so the ingredients you remember need not match the ones actually listed.

Output

For each test case, print every pair of words (w1, w2) such that w1 is an ingredient in the local language and w2 is an ingredient in your native language, and w1 and w2 appear on exactly the same set of pizzas (so w1 could mean the same ingredient as w2). Print each pair on its own line in the form (w1, w2). Sort the pairs in increasing lexicographical order by w1, breaking ties in increasing lexicographical order by w2. Print a blank line between consecutive test cases.