A Game Called Mind
题号:NC223534
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

This problem deals with a simplified version of a game called “Mind”. In this game, a group tries to cooperatively solve a problem. Assume: 
- There are 2-6 players (called A, B, C, D, E, F). 
- Each player has 1-9 cards in sorted order. 
- Each card value is between 10 and 99 (inclusive). 
- There are no duplicate values, i.e., a card (number) is in at most one hand. 

The objective of the game is for all the players to put all the cards down in sorted order (in the real game, players do not see their own cards, hence the name for the game – Mind). Given the cards in each hand, you are to provide the order for the players to place their cards down.

输入描述:

The first input line contains an integer, p (2 ≤ p ≤ 6), indicating the number of players. Each of  the following p input lines provides the cards for one player. Each line starts with an integer, c (1 ≤ c ≤ 9), indicating the number of cards for that player; the count is followed by the cards in sorted order (each card between 10 and 99, inclusive).

输出描述:

Print the order for the players to place down the cards so that the cards are in order.
示例1

输入

复制
2 
3 10 40 50
2 20 30

输出

复制
ABBAA
示例2

输入

复制
3 
4 40 51 60 70
3 12 32 42
5 20 53 80 90 95

输出

复制
BCBABACAACCC