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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;


public class P377A_Maze {
	
	static int V;
	static int[][] dfs_num;
	static int c;
	static ArrayList<Pair> res;
	static int n, m;
	static String[] lineas;
	public static void main(String[] args) throws IOException {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		String line;
		StringBuilder sb = new StringBuilder();
		StringTokenizer st;
		while( (line = bf.readLine()) != null){
			sb.append(line + "\n");
		}
		st = new StringTokenizer(sb.toString());
		
		n = Integer.parseInt(st.nextToken());
		m = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());
		lineas = new String[n];
		V = 0;
		for (int i = 0; i < lineas.length; i++) {
			lineas[i] = st.nextToken();
			count(lineas[i],i);
		}
		
		dfs_num = new int[n][m];
		c = 0;
		res = new ArrayList<>();
		boolean salir = false;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if(lineas[i].charAt(j) == '.'){
					dfs(i, j, k);
					salir = true;
					break;
				}
			}
			if(salir)
				break;
		}
						
		Pair aux;
		for (int i = 0; i < res.size(); i++) {
			aux = res.get(i);
			if(aux.y == 0){
				lineas[aux.x] = "X"+lineas[aux.x].substring(1);
			}else if(aux.y == m-1){
				lineas[aux.x] = lineas[aux.x].substring(0,lineas[aux.x].length()-1)+"X";
			}else{
				lineas[aux.x] = lineas[aux.x].substring(0, aux.y) + "X" + lineas[aux.x].substring(aux.y +1);
			}
		}
		
		for (int i = 0; i < lineas.length; i++) {
			System.out.println(lineas[i]);
		}
	}


	private static void dfs(int i, int j, int k) {
		if(V - k <= c)
			res.add(new Pair(i, j));
		dfs_num[i][j] = 1;
		if(i != 0 && lineas[i-1].charAt(j) == '.' && dfs_num[i-1][j] == 0){
			c++;
			dfs(i-1,j,k);
		}
		if(j != 0 && lineas[i].charAt(j-1) == '.' && dfs_num[i][j-1] == 0){
			c++;
			dfs(i,j-1,k);
		}
		if(i != n-1 && lineas[i+1].charAt(j) == '.' && dfs_num[i+1][j] == 0){
			c++;
			dfs(i+1,j,k);
		}
		if(j != m-1 && lineas[i].charAt(j+1) == '.' && dfs_num[i][j+1] == 0){
			c++;
			dfs(i,j+1,k);
		}
		
	}

	private static void count(String string, int fila) {		
		for (int i = 0; i < string.length(); i++) {
			if(string.charAt(i) == '.'){
				V++;
			}
		}
	}

}
class Pair{
	int x;
	int y;
	public Pair(int x, int y) {
		this.x = x;
		this.y = y;
	}
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return " x: "+x+" y: "+y;
	}
	
}