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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {


    enum Point {
        up(-1 ,0),down(1,0),right(0,1),left(0,-1);

        private final int x,y;

        Point(int x , int y){
            this.x=x;
            this.y=y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }
    }


     static class GridGraph {

        private char[][] maze;

         public GridGraph(int row, int column, BufferedReader console) throws IOException {

              maze = new char[row][column];
             for (int i = 0; i < maze.length; i++) {
                 String line = console.readLine();
                 for (int j = 0; j < maze[i].length; j++) {
                     maze[i][j] = line.charAt(j);
                 }
             }


         }

         public char[][] getMaze() {
             return maze;
         }

     }

    static class  PrintGrid{

        static void PrintGrid(GridGraph Graph){
            char[][] maze=Graph.getMaze();
            for (int i = 0; i < maze.length; i++) {
                for (int j = 0; j < maze[i].length; j++) {
                    System.out.print(maze[i][j]);
                }

                System.out.println();

            }


        }

    }

     static class MazeSolver {


        static private boolean [][]visited;
       static private int borderx;
       static private int bordery;
       private  static int numberOfTimes;
         public  MazeSolver() {


         }

         public static void solveMaze(GridGraph graph,int k){

             int x=0,y=0;


             char[][]maze=graph.getMaze();
             for(int i=0;i<maze.length;i++){
                 for(int j=0;j<maze[i].length;j++){
                     if(maze[i][j]=='.'){
                         x=i;
                         y=j;
                     }
                 }
             }

             numberOfTimes =k;
             borderx=maze.length;
             bordery=maze[0].length;
             visited=new boolean[maze.length][maze[0].length];
             dfs(maze,x,y);


         }

         public static void dfs(char [][]maze,int x, int y){

             if(x>=borderx)
                 return;

             if(y>=bordery)
                 return;

             if(x<0)
                 return;

             if(y<0)
                 return;



             if(visited[x][y])
                 return;

             if(maze[x][y]=='#')
                 return;



             visited[x][y]=true;

             for(int i=0;i<4;i++){

                 switch (i){

                     case 0:
                         dfs(maze,x+Point.up.getX(),y+Point.up.getY());
                         break;

                     case 1:
                         dfs(maze,x+Point.down.getX(),y+Point.down.getY());
                         break;

                     case 2:
                         dfs(maze,x+Point.right.getX(),y+Point.right.getY());
                         break;

                     case 3:
                         dfs(maze,x+Point.left.getX(),y+Point.left.getY());
                         break;

                 }
             }


             if(numberOfTimes !=0){
                 numberOfTimes--;
                 maze[x][y]='X';
             }


         }


     }


    public static void main(String[] args) throws IOException {

        BufferedReader   console = new BufferedReader( new InputStreamReader(System.in));
        String []rowColumn = console.readLine().split(" ");
        int row=Integer.parseInt(rowColumn[0]);
        int column=Integer.parseInt(rowColumn[1]);
        int k=Integer.parseInt(rowColumn[2]);
        GridGraph Graph= new GridGraph(row,column,console);
        MazeSolver.solveMaze(Graph,k);
        PrintGrid.PrintGrid(Graph);
        console.close();


    }
}