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.LinkedList;
import java.util.Queue;
import java.util.Scanner;

/**
 * Created by Rohit on 9/9/15.
 */
public class Maze {

    private static char[][] maze;
    private static boolean [][] visited;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int height = sc.nextInt();
        int width = sc.nextInt();
        int numWallsToAdd = sc.nextInt();
        sc.nextLine();
        maze = new char[height][width];
        int[] currentPos = new int[2];
        int numDots = 0;
        visited = new boolean[height][width];

//        print(maze);
        for (int row = 0; row < height; row++) {
            String rowChars = sc.nextLine();
            for (int col = 0; col < width; col++) {
                maze[row][col] = rowChars.charAt(col);

                if (findCurrentChar(maze, row, col) == '.')
                    currentPos = new int[]{row, col};

                if (rowChars.charAt(col) == '.') {
                    numDots++;
                }
            }

        }

        int numNewDots = numDots - numWallsToAdd;
        int numVisited = 0;

        Queue<int[]> q = new LinkedList<>();

        q.add(currentPos);
        int numNewWalls = 0;
        while (!q.isEmpty()) {
            currentPos = q.remove();
            if(!visited[currentPos[0]][currentPos[1]]) {
                visited[currentPos[0]][currentPos[1]] = true;
                numVisited++;
                int[] direction = {currentPos[0] + 1, currentPos[1]};
                checkDirection(q, direction);
                direction = new int[]{currentPos[0], currentPos[1] + 1};
                checkDirection(q, direction);
                direction = new int[]{currentPos[0] - 1, currentPos[1]};
                checkDirection(q, direction);
                direction = new int[]{currentPos[0], currentPos[1] - 1};
                checkDirection(q, direction);
                if (numVisited > numNewDots) {
                    numNewWalls++;
                    maze[currentPos[0]][currentPos[1]] = 'X';
//                print();
//                System.out.println();
                }
            }


        }
        print();
    }

    private static void checkDirection(Queue<int[]> q, int[] direction) {
        if(0 <= direction[0] && direction[0] < maze.length && 0 <= direction[1] && direction[1] < maze[0].length) {
            if (maze[direction[0]][direction[1]] == '.' && !visited[direction[0]][direction[1]]) {
                q.add(direction);
            }
        }
    }

    private static char findCurrentChar(char[][] maze, int row, int col) {
        return maze[row][col];
    }

    public static void print(){
        for(int row = 0; row < maze.length; row++){
            for(int col = 0; col < maze[0].length; col++)
                System.out.print(maze[row][col]);
            System.out.println();
        }
    }
}