A Game Called Mind
InterviewTime limit1sMemory limit1024 MB
Given each player's sorted cards, print the player letter for every card in ascending order of card value.
Problem
This problem deals with a simplified version of a game called "Mind". In this game, a group works together to solve a problem. Assume:
- There are 2 to 6 players (called A, B, C, D, E, F).
- Each player has 1 to 9 cards in sorted order.
- Each card value is between 10 and 99 (inclusive).
- There are no duplicate values. A card (number) is in at most one hand.
The goal is for all the players to put all the cards down in sorted order. In the real game, players cannot see their own cards, which is where the name Mind comes from. Given the cards in each hand, you must provide the order in which the players place their cards down.
Input
The first line contains an integer (), the number of players. Each of the following lines gives the cards for one player. Each line starts with an integer (), the number of cards for that player, followed by the cards in sorted order. Each card is an integer between 10 and 99, inclusive.
Output
Print the order in which the players place down the cards so that all the cards end up in sorted order.