Gravity#8216

Gravity

1 second
128 megabytes
Easy

You would like to implement a simple simulation of gravity on a -dimensional grid, consisting of rows and columns.

Some grid cells may contain obstacles, some may contain a single apple, and all others are empty.

The following rules are followed until no further changes are possible:

Find the final configuration of the grid after all apples have settled.

Input

The first line contains two space-separated integers and (1 \leq n, m \leq 50). Each of the next lines contains characters, describing the board, from top to bottom. Obstacles are denoted as #, apples are denoted as o, and empty cells are denoted as ..

Output

Print, on lines, the final configuration of the grid after executing the rules stated above.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading