Problem: Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.

Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any other one. Pavel doesn't like it when his maze has too little walls. He wants to turn exactly k empty cells into walls so that all the remaining cells still formed a connected area. Help him.

Input

The first line contains three integers n, m, k (1 ≤ n, m ≤ 500, 0 ≤ k < s), where n and m are the maze's height and width, correspondingly, k is the number of walls Pavel wants to add and letter s represents the number of empty cells in the original maze.

Each of the next n lines contains m characters. They describe the original maze. If a character on a line equals ".", then the corresponding cell is empty and if the character equals "#", then the cell is a wall.

Output

Print n lines containing m characters each: the new maze that fits Pavel's requirements. Mark the empty cells that you transformed into walls as "X", the other cells must be left without changes (that is, "." and "#").

It is guaranteed that a solution exists. If there are multiple solutions you can output any of them.

Examples

Input

3 4 2
#..#
..#.
#...


Output

#.X#
X.#.
#...


Input

5 4 5
#...
#.#.
.#..
...#
.#.#


Output

#XXX
#X#.
X#..
...#
.#.#

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;

public class A {
	public static void main(String[] args) {
		new A().run();
	}
	
	public void run() {
		InputReader reader = new InputReader(System.in);
		PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		
		int m = reader.nextInt();
		int n = reader.nextInt();
		int K = reader.nextInt();
		char[][] board = new char[m][];
		int si = -1;
		int sj = -1;
		for (int i = 0; i < m; i++) {
			board[i] = reader.next().toCharArray();
			for (int j = 0; j < n; j++) {
				if (board[i][j] == '.') {
					si = i;
					sj = j;
				}
			}
		}
		
		int[][] d = new int[m][n];
		for (int i = 0; i < m; i++) {
			Arrays.fill(d[i], INF);
		}
		d[si][sj] = 0;
		Queue <Integer> queue = new LinkedList <Integer> ();
		queue.add(si);
		queue.add(sj);
		while (!queue.isEmpty()) {
			int i = queue.remove();
			int j = queue.remove();
			for (int k = 0; k < 4; k++) {
				int i1 = i + di[k];
				int j1 = j + dj[k];
				if (0 <= i1 && i1 < m && 0 <= j1 && j1 < n && board[i1][j1] == '.' && d[i1][j1] > d[i][j] + 1) {
					d[i1][j1] = d[i][j] + 1;
					queue.add(i1);
					queue.add(j1);
				}
			}
		}
		
//		for (int i = 0; i < m; i++) {
//			for (int j = 0; j < n; j++) {
//				System.out.print(d[i][j] + " ");
//			}
//			System.out.println();
//		}
		
		TreeSet <Removal> set = new TreeSet <Removal> ();
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				if (d[i][j] < INF) {
					set.add(new Removal(d[i][j], i, j));
				}
			}
		}
		for (int i = 0; i < K; i++) {
			Removal removal = set.last();
			set.remove(removal);
			board[removal.i][removal.j] = 'X'; 
		}
		
		for (int i = 0; i < m; i++) {
			writer.println(new String(board[i]));
		}
		
		writer.close();
	}
	
	public static final int INF = (int)1e9 - 1;
	public static final int[] di = {-1, 0, 0, 1};
	public static final int[] dj = {0, -1, 1, 0};
	
	public class Removal implements Comparable <Removal> {
		public int d, i, j;
		
		public Removal(int d, int i, int j) {
			this.d = d;
			this.i = i;
			this.j = j;
		}
		
		public int compareTo(Removal other) {
			if (d != other.d) {
				return d - other.d;
			}
			if (i != other.i) {
				return i - other.i;
			}
			return j - other.j;
		}
	}
	
	public static boolean test(char[][] board, int[][] d, int SI, int SJ) {
		int m = board.length;
		int n = board[0].length;
		int si = -1;
		int sj = -1;
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				if (si == -1 && sj == -1 && board[i][j] == '.') {
					si = i;
					sj = j;
				}
			}
		}
		
		boolean[][] free = new boolean[m][n];
		for (int i = 0; i < m; i++) {
			Arrays.fill(free[i], true);
		}
		free[si][sj] = false;
		Queue <Integer> queue = new LinkedList <Integer> ();
		queue.add(si);
		queue.add(sj);
		while (!queue.isEmpty()) {
			int i = queue.remove();
			int j = queue.remove();
			for (int k = 0; k < 4; k++) {
				int i1 = i + di[k];
				int j1 = j + dj[k];
				if (0 <= i1 && i1 < m && 0 <= j1 && j1 < n && board[i1][j1] == '.' && free[i1][j1]) {
					free[i1][j1] = false;
					queue.add(i1);
					queue.add(j1);
				}
			}
		}
		
		int threshold = 2;
		int threshold2 = 20;
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				if (board[i][j] == '.' && free[i][j]) {
					System.out.println("si = " + SI + " , sj = " + SJ + " --> " + d[i][j]);
					System.out.println("Maze not connected at " + i + " " + j);
					for (int i1 = -threshold; i1 <= threshold; i1++) {
						for (int j1 = -threshold2; j1 <= threshold2; j1++) {
							int i2 = i + i1;
							int j2 = j + j1;
							if (0 <= i2 && i2 < m && 0 <= j2 && j2 < n) {
								System.out.print(board[i2][j2]);
							}
						}
						System.out.println();
					}
					return false;
				}
			}
		}
		
		return true;
	}
	
	public class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;
		
		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					return null;
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}