Tetris is played in a well that has N rows and 20 columns. Figures fall straight down into the well one at a time; each figure is a set of cells that is connected through shared edges (up, down, left, right). When a figure falls it keeps dropping until at least one of its cells lands on the floor or on top of a cell that is already occupied.
After every figure has landed, each one is marked with a distinct uppercase letter from A to Z. Given the final contents of the well, reconstruct an order in which the figures could have fallen.
A figure could have been the most recent one to land only if it can be lifted straight up out of the well without passing through any other figure — that is, no other figure occupies a cell directly above one of its cells in the same column. Removing figures this way, from the last one to the first, recovers a valid falling order.
The first line contains an integer N (1≤N≤50), the number of rows.
Each of the next N lines contains exactly 20 characters. Every character is either an uppercase letter from A to Z, marking a cell that belongs to a figure, or a dot . (ASCII 46), marking an empty cell.
Print a single line containing the letters of the figures in the order they fell. If more than one order is possible, print the lexicographically smallest one. The input guarantees that at least one valid order exists.