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

public class a222 {

	static class Task {		
		
		public void Solve(InputReader in,PrintWriter out)
		{
			n=in.nextInt();
			m=in.nextInt();
		    k=in.nextInt();
			arr=new char[n][m];
			vis=new boolean[n][m];
			for(int i=0;i<n;i++)
				arr[i]=in.next().toCharArray();
			e=0;
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					if(arr[i][j]=='.')
						e++;
					else
						vis[i][j]=true;
				}
			}
			Point p=findIndex(arr);
			dfs(p.x, p.y);
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					if(vis[i][j]==false)
						arr[i][j]='X';
				}
			}
			joutArray(arr, n, m);
			
		}
	}
	
	static void dfs(int i,int j)
	{
		if(count>=(e-k))
			return;
		vis[i][j]=true;
		count++;
		for(int k=0;k<4;k++)
		{
			int i1=i+di[k];
			int j1=j+dj[k];
			if(isValid(i1,j1) && !vis[i1][j1])
			{
				dfs(i1,j1);
			}
			
		}
	}
	
	static boolean isValid(int i,int j)
	{
		if(i<n && j<m && i>=0 && j>=0 && arr[i][j]=='.')
			return true;
		return false;
	}
	
	static int k,e;
	static int count=0;
	static boolean vis[][];
	static int n;
	static int m;
	static char arr[][];
	
	static Point findIndex(char arr[][])
	{
		for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)
				if(arr[i][j]=='.')
					return new Point(i,j);
		return new Point(-1,-1);
	}
	
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Task solve = new Task();
        solve.Solve(in,out);
        out.close();
    }
    
    static void sort(int arr[][]){
        Arrays.sort(arr,new Comparator<int[]>(){
        public int compare(int[] a, int[] b) {
            return a[0]-b[0];
        }});
    }
    
    static void sort(int arr[]){
		int cnt[]=new int[(1<<16)+1];
		int ys[]=new int[arr.length];	
		for(int j=0;j<=16;j+=16){
			Arrays.fill(cnt,0);
			for(int x:arr){cnt[(x>>j&0xFFFF)+1]++;}
			for(int i=1;i<cnt.length;i++){cnt[i]+=cnt[i-1];}
			for(int x:arr){ys[cnt[x>>j&0xFFFF]++]=x;}
			{ final int t[]=arr;arr=ys;ys=t;}
		}
		if(arr[0]<0||arr[arr.length-1]>=0)return;
		int i,j,c;
		for(i=arr.length-1,c=0;arr[i]<0;i--,c++){ys[c]=arr[i];}
		for(j=arr.length-1;i>=0;i--,j--){arr[j]=arr[i];}
		for(i=c-1;i>=0;i--){arr[i]=ys[c-1-i];}
	}
    
	static int[] di={1,0,-1,0,1,-1,-1,1};
	static int[] dj={0,1,0,-1,1,1,-1,-1};

    static int min(int x,int y){return x<y?x:y;}
    static int max(int x,int y){return x>y?x:y;}
    static int lcm(int a,int b){return a*b/gcd(a,b);}
    static int gcd(int a,int b){return b==0?a:gcd(b,a%b);} 
    static int abs(int x){if(x>=0)return x;else return -x;}

    static long min(long x,long y){return x<y?x:y;}
    static long max(long x,long y){return x>y?x:y;}
    static long lcm(long a,long b){return a*b/gcd(a,b);}
    static long gcd(long a,long b){return b==0?a:gcd(b,a%b);}
    static long abs(long x){if(x>=0)return x;else return -x;}

    static void joutArray(int arr[]){
    	for(int i=0;i<arr.length;i++){
    		System.out.print(arr[i]+" ");
    	}
    	System.out.println();
    }
    
    static void joutArray(char arr[][],int n,int m){
    	for(int i=0;i<n;i++){
    		for(int j=0;j<m;j++)
    		System.out.print(arr[i][j]);
    		System.out.println();
    	}
    	System.out.println();
    }

    static class InputReader {
        public BufferedReader reader;
        public 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 nextLine() {
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

        public int nextInt() {
            return Integer.parseInt(next());
        }
        
        public long nextLong() {
        	return Long.parseLong(next());
        }
        
        public double nextDouble() {
        	return Double.parseDouble(next());
        }
        
        public int[] nextIntArray(int n) {
        	int arr[]=new int[n];
        	for(int i=0;i<n;i++)
        		arr[i]=nextInt();
        	return arr;
        }
        
        public char[] nextCharArray(){
        	char arr[]=next().toCharArray();
        	return arr;
        }
        
        public HashMap<Integer,Integer> nextHashMap(int n){
        	HashMap<Integer,Integer> hm=new HashMap<>();
        	for(int i=0;i<n;i++){
    			int num=nextInt();
    			hm.put(num,hm.get(num)==null?1:hm.get(num)+1);
    		}
        	return hm;
        }
     }
    
   }