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 static java.lang.Math.*;
import static java.lang.System.out;
import static java.util.Arrays.*;
import java.math.*;
import java.io.*;
import java.util.*;

public class Main {
	static boolean LOCAL = System.getSecurityManager() == null;
	Scanner in = new Scanner(System.in);
	char[][] maps;
	boolean[][] vis;
	int cnt;
	int n, m;
	void run() {
		n = in.nextInt();
		m = in.nextInt();
		int k = in.nextInt();
		maps = new char[n][m];
		for (int i = 0; i < n; i++) {
			maps[i] = in.next().toCharArray();
		}
		int sum = 0;
		
		vis = new boolean[n][m];
		PriorityQueue<Item> pq = new PriorityQueue<Item>();
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (!vis[i][j] && maps[i][j] != '#') {
					pq.add(new Item(count(i, j), i, j));
				}
			}
		}
		Item c = pq.poll();
		sum = c.s;
		while (!pq.isEmpty()) {
			sum += pq.poll().s;
		}
		cnt = sum - k;
		for (boolean[] bs : vis) fill(bs, false);
		dfs(c.x, c.y);
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (!vis[i][j] && maps[i][j] != '#') maps[i][j] = 'X';
			}
		}
		for (int i = 0; i < n; i++) {
			out.println(maps[i]);
		}
	}
	boolean in(int x, int y) {
		return x >= 0 && y >= 0 && x < n && y < m;
	}
	int[] dx = new int[] {0, 0, 1, -1};
	int[] dy = new int[] {1, -1, 0, 0};
	int count(int x, int y) {
		vis[x][y] = true;
		int ans = 1;
		for (int i = 0; i < 4; i++) {
			int tx = x + dx[i], ty = y + dy[i];
			if (in(tx, ty) && maps[tx][ty] != '#' && !vis[tx][ty]) {
				ans += count(tx, ty);
			}
		}
		return ans;
	}
	void dfs(int x, int y) {
		if (cnt == 0) return ;
		vis[x][y] = true;
		cnt--;
		for (int i = 0; i < 4; i++) {
			int tx = x + dx[i], ty = y + dy[i];
			if (in(tx, ty) && maps[tx][ty] != '#' && !vis[tx][ty]) {
				dfs(tx, ty);
			}
		}
	}
	class Item implements Comparable<Item>{
		int s, x, y;

		public Item(int s, int x, int y) {
			this.s = s;
			this.x = x;
			this.y = y;
		}
		public int compareTo(Item it) {
			return it.s - s;
		}
	}
	void debug(Object... os) {
		System.err.println(deepToString(os));
	}

	public static void main(String[] args) {
		if (LOCAL) {
			try {
				System.setIn(new FileInputStream("./../../in"));
//				System.setOut(new PrintStream("./../../out"));
			} catch (Throwable e) {
				LOCAL = false;
			}
		}
		long start = 0;
		if (LOCAL)
			start = System.nanoTime();
		new Main().run();
		if (LOCAL)
			out.printf("[Time : %.6f]%n", (System.nanoTime() - start) * 1e-9);
	}
}

class Scanner {
	BufferedReader br;
	StringTokenizer st;

	Scanner(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		eat("");
	}

	void eat(String s) {
		st = new StringTokenizer(s);
	}

	String nextLine() {
		try {
			return br.readLine();
		} catch (IOException e) {
			return null;
		}
	}

	boolean hasNext() {
		while (!st.hasMoreTokens()) {
			String s = nextLine();
			if (s == null)
				return false;
			eat(s);
		}
		return true;
	}

	String next() {
		hasNext();
		return st.nextToken();
	}

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

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

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