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.math.*;
public class Main
{
    static boolean[]vis;
    static ArrayList<Integer>[]g;
    public static void process()throws IOException
    {
        int n=ni();
        int m=ni();
        int k=ni();
        char[][]A=new char[n+5][m+5];
        for(int i=1;i<=n;i++)
        {
            String s=nln();
            for(int j=1;j<=m;j++)
                A[i][j]=s.charAt(j-1);
        }
        g=new ArrayList[n*m+10];
        vis=new boolean[n*m+10];
        for(int i=0;i<=n*m+9;i++)
            g[i]=new ArrayList<Integer>();
        int c=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                int curr=(i-1)*m+j;
                if(A[i][j]=='.')
                {
                    c++;
                if(A[i][j]==A[i][j+1])
                    g[curr].add(curr+1);
                if(A[i][j]==A[i][j-1])
                    g[curr].add(curr-1);
                if(A[i][j]==A[i-1][j])
                    g[curr].add(curr-m);
                if(A[i][j]==A[i+1][j])
                    g[curr].add(curr+m);
                }
                else
                    vis[curr]=true;
            }
        }
        for(int i=1;i<=n*m;i++)
        {
            if(!vis[i])
            {
                bfs(i,n*m,c-k);
                break;
            }
        }
        for(int i=1;i<=n*m;i++)
        {
            if(!vis[i])
            {
                int x=(int)Math.ceil(((double)i/m));
                int y=(i-1)%m+1;
                A[x][y]='X';
            }
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
                p(A[i][j]);
            pn("");
        }
    }
    
    static void bfs(int src,int n,int s)
    {
        vis[src]=true;
        int c=1;
        if(s==1)
            return;
        Queue<Integer>q=new LinkedList<Integer>();
        q.add(src);
            while(!q.isEmpty())
            {
                int x=q.poll();
                for(int i=0;i<g[x].size();i++)
                {
                    int y=g[x].get(i);
                    if(!vis[y])
                    {
                        q.add(y);
                        c++;
                        vis[y]=true;
                        if(c==s)
                            return;
                        
                    }
                }      
            }
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}