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.math.*;
import java.io.*; 
 public class B{
static int[] dx={-1,1,0,0};
static int[] dy={0,0,1,-1};
    static FastReader scan=new FastReader();
   public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
   static boolean prime[];
   static void sieve(int n) 
    { 
        
        prime = new boolean[n+1]; 
        for(int i=0;i<n;i++) 
            prime[i] = true; 
          
        for(int p = 2; p*p <=n; p++) 
        { 
           
            if(prime[p] == true) 
            { 
                
                for(int i = p*p; i <= n; i += p) 
                    prime[i] = false; 
            } 
        } 
          
        
    }  
   static LinkedList<Pair>edges[];
   
 public static boolean areSame(int []arr)
    {
        // Put all array elements in a HashSet
        Set<Integer>s=new HashSet<Integer>();
        for(int i=0;i<arr.length;i++)
            s.add(arr[i]);

 
        // If all elements are same, size of
        // HashSet should be 1. As HashSet contains only distinct values.
        return (s.size() == 1);
    }
   

    
     public static int lowerBound(long[] array, int length, int value) {
        int low = 0;
        int high = length;
        while (low < high) {
            final int mid = (low + high) / 2;
            //checks if the value is less than middle element of the array
            if (value <= array[mid]) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }
        return low;
    }
    public static int upperBound(long[] array, int length, int value) {
        int low = 0;
        int high = length;
        while (low < high) {
            final int mid = (low + high) / 2;
            if (value >= array[mid]) {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        return low;
    }
static long mod(long x,long y)
    {
        if(x<0)
            x=x+(-x/y+1)*y;
        return x%y;
    }
    static int N;
    static int arr[]={1 ,4, 2 ,3 ,9 ,1};
    static int weights[];
    static int benefit[];
    static int inial=20;
    static int LIS(int i,int prev)
    {
        if(i==6)
            return 0;  
        int choice1=LIS(i+1,prev);
        int choice2=0;
        if(arr[prev]<arr[i])
        {
           choice2=LIS(i+1,i)+1;
        }
        return Math.max(choice2,choice1);
    }
    static int dp[][];
    static int knap(int i,int rem)
    {
        if(i==N||rem<0)
            return 0;
        if(dp[i][rem]!=-1)
            return dp[i][rem];
if(rem<weights[i])
    return knap(i+1,rem);
else 
        return dp[i][rem]=Math.max(knap(i+1,rem),knap(i+1,rem-weights[i])+benefit[i]);
        //int choice2=0;
       
     //dp[i][rem]= Math.max(choice2,choice1);
     //return dp[N-1][rem];

        
    }
    static char board[][];
    static int n,m,c=0,s=0,k;
    static boolean e(int x,int y)
    {
        return (x>=0&&y>=0&&x<n&&y<m&&board[x][y]!='#');
    }
    static boolean vis[][]=new boolean[501][501];

    static void dfs(int x,int y)
    {
        if(!e(x,y)||vis[x][y])
            return;
        if(s-k==c)
            return;
        vis[x][y]=true;
        c++;
            dfs(x+1,y);
            //c++;
            dfs(x-1,y);
            //c++;
            dfs(x,y+1);
            //c++;
            dfs(x,y-1);
           // c++;

    }
    public static void main(String[] args)  throws IOException 
{
//java.util.Scanner scan=new java.util.Scanner(new File("mootube.in"));
 //PrintWriter out = new PrintWriter (new FileWriter("mootube.out"));
//java.util.Scanner scan=new java.util.Scanner(new File("bcount.in"));
//PrintWriter out = new PrintWriter (new FileWriter("bcount.out"));
 n=scan.nextInt();
 m=scan.nextInt();
 k=scan.nextInt();
board=new char[n][m];
for(int i=0;i<n;i++)
board[i]=scan.next().toCharArray();
int x=-1,y=-1;
for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
        if(board[i][j]=='.'){
            if(~x==0){
                x=i;
                y=j;
            }
            s++;
        }

dfs(x,y);
//out.println(x+" "+y);
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
if(!vis[i][j]&&board[i][j]!='#')
board[i][j]='X';        
for(int i=0;i<n;i++)
{
    for(int j=0;j<m;j++)
        out.print(board[i][j]);
    out.println();
}

out.close();



    

}
 public static  long pow(long b, long e) {
            long r = 1;
            while (e > 0) {
                if (e % 2 == 1) r = r * b ;
                b = b * b;
                e >>= 1;
            }
            return r;
        }
private static void sort(long[] arr) {
        List<Long> list = new ArrayList<>();
        for (long object : arr) list.add(object);
        Collections.sort(list);
        for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
    }
 public static class FastReader {
        BufferedReader br;
        StringTokenizer root;
        
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (root == null || !root.hasMoreTokens()) {
                try {
                    root = new StringTokenizer(br.readLine());
                } catch (Exception addd) {
                    addd.printStackTrace();
                }
            }
            return root.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception addd) {
                addd.printStackTrace();
            }
            return str;
        }
         public int[] nextIntArray(int arraySize) {
            int array[] = new int[arraySize];
 
            for (int i = 0; i < arraySize; i++) {
                array[i] = nextInt();
            }
 
            return array;
        }
}
public static class Pair implements Comparable<Pair>{
        public int x, y;
        public Pair(int x1, int y1) {
            x=x1;
            y=y1;
        }
        @Override
        public int hashCode() {
            return (int)(x + 31 * y);
        }
        public String toString() {
            return x + " " + y;
        }
        @Override
        public boolean equals(Object o){
            if (o == this) return true;
            if (o.getClass() != getClass()) return false;
            Pair t = (Pair)o;
            return t.x == x && t.y == y;
        }
        public  int compareTo(Pair o)
        {
            return x-o.x;
        }
static class pair{
	int i;
	int j;
pair(int i,int j){
	this.i=i;
	this.j=j;
}

}}}