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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;

public class Solution {

	static InputReader in = new InputReader(System.in);
	static OutputWriter out = new OutputWriter(System.out);
	static int mod = (int) (1e9 + 7);

	static char[][] maze;
	static int lines;
	static int columns;
	static int k;
	static int countX;
	static int countFree;

	static int[] dl = { 1, 0, -1, 0 };
	static int[] dc = { 0, 1, 0, -1 };

	public static void main(String[] args) throws IOException {

		lines = in.nextInt();
		columns = in.nextInt();
		k = in.nextInt();
		countX = 0;

		maze = new char[lines][columns];

		List<Pair> empty = new ArrayList<>();

		for (int i = 0; i < lines; i++) {
			String input = in.readLine();
			for (int j = 0; j < input.length(); j++) {
				maze[i][j] = input.charAt(j);
				if (maze[i][j] == '.') {
					empty.add(new Pair(i, j));
				}
			}
		}

		countFree = empty.size();

		dfs(empty.get(0).x, empty.get(0).y);
		printMatrix(maze);
		out.close();
	}

	private static void printMatrix(char[][] mat) {

		for (int i = 0; i < lines; i++) {
			for (int j = 0; j < columns; j++) {
				
				out.print(mat[i][j] == '#' ? "#" : (mat[i][j] == 'X'?'.':'X'));
			}
			out.println();
		}

	}

	private static void dfs(int l, int c) {

		if (countX == countFree - k)
			return;

		countX++;
		maze[l][c] = 'X';

		for (int i = 0; i < 4; i++) {
			if (canMove(l + dl[i], c + dc[i])) {
				dfs(l + dl[i], c + dc[i]);
			}
		}

	}

	private static boolean canMove(int l, int c) {

		if (l >= lines)
			return false;
		if (c >= columns)
			return false;

		if (l < 0 || c < 0 || maze[l][c] != '.') {
			return false;
		}

		return true;
	}
}

class CustomComparator implements Comparator<Integer> {

	@Override
	public int compare(Integer e1, Integer e2) {
		return e2.compareTo(e1);
	}
}

class Pair {

	int x;
	int y;

	public Pair(int x, int y) {
		this.x = x;
		this.y = y;
	}

	@Override
	public String toString() {
		return "Pair [x=" + x + ", y=" + y + "]";
	}
}

class OutputWriter {
	public PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void println(Object... objects) {
		print(objects);
		writer.println();
	}

	public void close() {
		writer.close();
	}
}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String readLine() {
		try {
			return reader.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public float nextFloat() {
		return Float.parseFloat(next());
	}

}