1704 - Double Pieces   

Description

Monkey D. Luffy is a young man who wants to become the King of the Pirates! Now he and his crew are deciding which sailing route they want to go, among the many islands in the Grand Line.

Luffy’s good friend, Nami, is the navigator of Luffy’s pirate boat Thousand Sunny. Nami wants to know all the possible sailing routes to traverse all the islands in the Grand Line. As an assistant, you need to help Nami to do this work.

Input

The first line contains a positive integer t (t <= 20), which indicates how many cases in the input. Each case starts with a positive integer n (n <= 10), which denotes the number of the islands in the Grand Line. In the next n lines, each line contains the name of an island. The length of name is at most 20, and the name is composed only by English letters.

Output

For each case, first line output the case number (See the Sample Output). Next, output all possible sailing routes in the Grand Line, and for each route, use “-” to separate two consecutive islands. Each line contains one route and the ordering of the routes can be arbitrary (See the Sample Output).

Sample Input  Download

Sample Output  Download

Tags




Discuss