Tetris Alphabet

Time Limit: 1 Second    Memory Limit: 32768 KB

The game of Tetris is played with four-connected blocks falling down the well having N rows and 20 columns. Each figure is marked with a unique English letter from 'A' to 'Z'.

Your program must, given the state of the well, determine the order in which the blocks fell down.

Input

The first line of input contains integer N (1 <= N <= 50) - number of rows. Following N lines contain 20 characters each, with characters that are either a letter from 'A' to 'Z' or the dot character (ASCII 46), representing an empty cell.


This problem contains multiple test cases!

The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.

Output

Output must contain a string of letters indicating the order in which figures fell down. If there is more than one order, lexicographically smallest one must be printed. Input data will guarantee that at least one nonempty order exists.

The output format consists of N output blocks. There is a blank line between output blocks.

Sample Input

1

6
...........XX.......
..........MMMM......
..........K.........
........KKK.........
.....ZAAA.FFF.......
.....ZZZA..F.B......

Sample Output

BFZAKMX
Submit

Source: Northeastern Europe 2002, Far-Eastern Subregion