// Arup Guha
// 11/5/2016
// Solution to SER 2016 Division II Problem D: Gravity

import java.util.*;

public class gravity {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int r = stdin.nextInt();
		int c = stdin.nextInt();
		char[][] grid = new char[r][];
		for (int i=0; i<r; i++)
			grid[i] = stdin.next().toCharArray();

		// Go through each column.
		for (int j=0; j<c; j++) {

			// Rows from bottom to top.
			for (int i=r-1; i>=0; i--) {

				// Let this one fall...
				if (grid[i][j] == 'o') {

					// See where it falls to.
					int x = i+1;
					while (x < r && grid[x][j] == '.') x++;
					x--;
					grid[i][j] = '.';
					grid[x][j] = 'o';
				}
			}
		}

		// Ta da!
		for (int i=0; i<r; i++)
			System.out.println(new String(grid[i]));
	}
}