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;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;

public class C {
    static char[][] A;
    static int[][] count;

    public static void solve(Node x, int left) {
        for (Node n : x.children) {
            int count = count(n);
            if (count <= left) {
                mark(n);
                left -= count;
            } else {
                solve(n, left);
                break;
            }
        }
    }

    public static int count(Node x) {
        if (count[x.x][x.y] != -1)
            return count[x.x][x.y];
        int ans = 1;
        for (Node n : x.children)
            ans += count(n);
        return count[x.x][x.y] = ans;
    }

    public static void mark(Node x) {
        A[x.x][x.y] = 'X';
        for (Node n : x.children)
            mark(n);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] S = in.readLine().split(" ");
        int n = Integer.parseInt(S[0]);
        int m = Integer.parseInt(S[1]);
        int k = Integer.parseInt(S[2]);
        A = new char[n][m];
        count = new int[n][m];
        for (int i = 0; i < n; i++)
            Arrays.fill(count[i], -1);
        for (int i = 0; i < n; i++)
            A[i] = in.readLine().toCharArray();
        Queue<Node> Q = new LinkedList<Node>();
        for (int i = 0; i < n && Q.isEmpty(); i++)
            for (int j = 0; j < m && Q.isEmpty(); j++)
                if (A[i][j] == '.')
                    Q.add(new Node(i, j));
        Node start = Q.peek();
        int[] dx = { 0, 0, 1, -1 };
        int[] dy = { 1, -1, 0, 0 };
        boolean[][] visited = new boolean[n][m];
        visited[start.x][start.y] = true;
        while (!Q.isEmpty()) {
            Node temp = Q.poll();
            for (int i = 0; i < 4; i++) {
                int x = temp.x + dx[i];
                int y = temp.y + dy[i];
                if (x < 0 || y < 0 || x == n || y == m)
                    continue;
                if (visited[x][y] || A[x][y] == '#')
                    continue;
                visited[x][y] = true;
                Q.add(temp.addChild(x, y));
            }
        }
        solve(start, k);
        PrintWriter out = new PrintWriter(System.out);
        for (int i = 0; i < n; i++)
            out.println(new String(A[i]));
        out.flush();
        out.close();
    }
}

class Node {
    int x;
    int y;
    LinkedList<Node> children;

    public Node(int i, int j) {
        x = i;
        y = j;
        children = new LinkedList<Node>();
    }

    public Node addChild(int i, int j) {
        Node s = new Node(i, j);
        children.add(s);
        return s;
    }
}