시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB18115714385.629%

문제

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

예제 출력 1

ABBAA

예제 입력 2

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

예제 출력 2

BCBABACAACCC