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:
/*
 * Remember a 7.0 student can know more than a 10.0 student.
 * Grades don't determine intelligence, they test obedience. 
 * I Never Give Up.
 */
import java.util.*;
import java.util.Map.Entry;
import java.io.*;

import static java.lang.System.out;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class ContestMain {
	private static Reader in=new Reader();
	private static StringBuilder ans=new StringBuilder();
	private static long MOD=1000000007;//10^9+7 
	private static final int N=1000000;//10^6
	private static final int LIM=26;
//	private static final double PI=3.1415;
	private static ArrayList<Integer> v[]=new ArrayList[N];
//	private static int color[]=new int[N]; //For Graph Coloring
	private static boolean mark[]=new boolean[N];
//	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	private static void dfs(int node,ArrayList<Integer> r){
		mark[node]=true;
		for(int x:v[node]){
			if(!mark[x]){
				dfs(x,r);
			}
		}
		r.add(node);
	}
	private static long powmod(long x,long n,long m){
		if(n==0)return 1;
		else if(n%2==0)return(powmod((x*x)%m,n/2,m));
		else return (x*(powmod((x*x)%m,(n-1)/2,m)))%m;
	}
//	private static void shuffle(String[] arr) {
//		for (int i = arr.length - 1; i >= 2; i--) {
//			int x = new Random().nextInt(i - 1);
//	        String temp = arr[x];
//	        arr[x] = arr[i];
//	        arr[i] = temp;
//	    }
//	 }
	public static void main(String[] args) throws IOException{
		int n=in.nextInt();
		int m=in.nextInt();
		int k=in.nextInt();
		String ar[]=new String[n];
		int matrix[][]=new int[n][m];
		HashMap<Integer,String> map=new HashMap();
		int c=1;
		for(int i=0;i<n;i++)ar[i]=in.next();
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				matrix[i][j]=c++;
				map.put(matrix[i][j],i+" "+j);
			}
		}
		int start=-1;
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(ar[i].charAt(j)=='.'){
					if(start==-1)start=matrix[i][j];
					v[matrix[i][j]]=new ArrayList();
					if(i-1>=0&&ar[i-1].charAt(j)=='.')v[matrix[i][j]].add(matrix[i-1][j]);
					if(i+1<n&&ar[i+1].charAt(j)=='.')v[matrix[i][j]].add(matrix[i+1][j]);
					if(j-1>=0&&ar[i].charAt(j-1)=='.')v[matrix[i][j]].add(matrix[i][j-1]);
					if(j+1<m&&ar[i].charAt(j+1)=='.')v[matrix[i][j]].add(matrix[i][j+1]);
				}
			}
		}
		ArrayList<Integer> res=new ArrayList();
		dfs(start,res);
		int cor[][]=new int[n][m];
		String s[]=new String[2];
		for(int i=0;i<k;i++){
			s=map.get(res.get(i)).split(" ");
			cor[Integer.parseInt(s[0])][Integer.parseInt(s[1])]=1;
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(cor[i][j]==1)out.print("X");
				else out.print(ar[i].charAt(j));
			}
			out.println();
		}
	}
	static class Pair implements Comparable<Pair>{
		long l;
		long r;
		Pair(){
			l=0;
			r=0;
		}
		Pair(long k,long v){
			l=k;
			r=v;
		}
		@Override
		public int compareTo(Pair o) {
			if(l!=o.l)return (int) (l-o.l);
			else return (int) (r-o.r);
		}
		
	}
	static class Reader{
        BufferedReader br;
        StringTokenizer st;
        public Reader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}