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.*;
import java.util.*;

public class ques3
{
	public static void main(String[] args)throws Exception{ new ques3().run();} 
	long mod=1000000000+7;
	ArrayList<Integer> adj[];
	int N;
	int vis[];
	char c[][];int n,m;
	int h[];
	ArrayList<int[]> height;
	void init(int N)
	{
		adj=new ArrayList[N+1];
		vis=new int[N+1];
		h=new int[N+1];
		height=new ArrayList<int[]>();
		for (int i = 0; i < adj.length; i++) 
			adj[i]=new ArrayList<>();
	}
	void solve() throws Exception
	{
		 n=ni();
		 m=ni();
		int k=ni();
		init(n*m);
		c=new char[n][m];
		int g[][]=new int[n][m];
		int dx[]={1,0,-1,0};
		int dy[]={0,-1,0,1};
		int in=0;
		for (int i = 0; i <n; i++) {
			for (int j = 0; j < m; j++) {
				c[i][j]=nc();
				g[i][j]=++in;
			}
		}
		int root=0;
		for (int i = 0; i <n; i++) {
			for (int j = 0; j < m; j++) {
				  if(c[i][j]=='.')
				  {
					  root=g[i][j];
					for(int d=0;d<4;d++)
						if(check(i+dx[d],j+dy[d]))
							{
							adj[g[i][j]].add(g[i+dx[d]][j+dy[d]]);
							adj[g[i+dx[d]][j+dy[d]]].add(g[i][j]);
							}
				  }
			}
		}
		dfs(root,-1);
		for (int i = 1; i < h.length; i++) {
			height.add(new int[] {i,h[i]});
		}
		Collections.sort(height, new Comparator<int[]>() {
			@Override
			public int compare(int[] o1, int[] o2) {
				// TODO Auto-generated method stub
				return o2[1]-o1[1];
			}
		});
		
		HashSet<Integer> set=new HashSet<>();
		for(int i=0;i<k;i++)
		{
			int ind=height.get(i)[0];
			set.add(ind);
		}
		in=0;
		for (int i = 0; i <n; i++) {
			for (int j = 0; j < m; j++) {
				++in;
				if(set.contains(in))
					out.print("X");
				else
					out.print(c[i][j]);
			}
			out.println();
		}
	}
	void dfs(int u, int par)
	{
		h[u]=(par!=-1)?h[par]+1:0;
		vis[u]=1;
		for(int v:adj[u])
		{
			if(vis[v]==1)continue;
			dfs(v,u);
		}
	}
	boolean check(int x, int y)
	{
		if(x<0||x>=n||y<0||y>=m)return false;
		if(c[x][y]=='.')
			return true;
		return false;
	}
	int min(int... ar)
	{
		int min=Integer.MAX_VALUE;
		for(int i:ar)
			min=Math.min(min, i);
		return min;
	}
	int max(int... ar) 
	{
		int max=Integer.MIN_VALUE;
		for(int i:ar)
			max=Math.max(max, i);
		return max;
	}
	int[] shuffle(int a[]) {
		ArrayList<Integer> al = new ArrayList<>();
		for(int i=0;i<a.length;i++) {
			al.add(a[i]);
		}
		Collections.sort(al);
		for(int i=0;i<a.length;i++) {
			a[i]=al.get(i);
		}
		return a;
	}
	/*IMPLEMENTATION BY AMAN KOTIYAL, FAST INPUT OUTPUT & METHODS BELOW*/
	
	private byte[] buf=new byte[1024];
	private int index;
	private InputStream in;
	private int total;
	private SpaceCharFilter filter;
	PrintWriter out;
	
	int gcd(int a, int b) 
	{ 
		if (a == 0) 
			return b; 
		return gcd(b%a, a); 
	} 
	long gcd(long a, long b) 
	{ 
		if (a == 0) 
			return b; 
		return gcd(b%a, a); 
	}
	/* for (1/a)%mod = ( a^(mod-2) )%mod  ----> use expo to calc -->(a^(mod-2)) */
	long expo(long p,long q)  /*  (p^q)%mod   */
	{
		long z = 1;
		while (q>0) {
			if (q%2 == 1) {
				z = (z * p)%mod;
			}
			p = (p*p)%mod;
			q >>= 1;
		}
		return z;
	}
	void run()throws Exception
	{
		in=System.in; out = new PrintWriter(System.out);
		solve();
		out.flush();
	}
	private int scan()throws IOException
	{
		if(total<0)
			throw new InputMismatchException();
		if(index>=total)
		{
			index=0;
			total=in.read(buf);
			if(total<=0)
				return -1;
		}
		return buf[index++];
	}
	private int ni() throws IOException 
	{
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = scan();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = scan();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	private long nl() throws IOException 
	{
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = scan()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = scan();
		}
		
		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = scan();
		}
	}
	private double nd() throws IOException{
		return Double.parseDouble(ns());
	}
	private String ns() throws IOException {
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		StringBuilder res = new StringBuilder();
		do {
			if (Character.isValidCodePoint(c))
				res.appendCodePoint(c);
			c = scan();
		} while (!isSpaceChar(c));
		return res.toString();
	}
	private String nss() throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		return br.readLine();
	}
	private char nc() throws IOException 
	{
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		return (char) c;
	}
	private boolean isWhiteSpace(int n)
	{
		if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
			return true;
		return false;
	}
	private boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhiteSpace(c);
	}
	private interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}