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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.LinkedList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        int n;
        int m;
        StringBuilder[] arr;
        int[] dx = {0, 1, 0, -1};
        int[] dy = {1, 0, -1, 0};

        boolean check(int x, int y) {
            return 0 <= x && x < n && 0 <= y && y < m && arr[x].charAt(y) != '#';
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.ni();
            m = in.ni();
            int k = in.ni();
            arr = new StringBuilder[n];
            for (int i = 0; i < n; i++)
                arr[i] = new StringBuilder(in.n());
            int[][] value = new int[n][m];
            int sr = 0;
            int sc = 0;
            boolean found = false;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (arr[i].charAt(j) == '.') {
                        sr = i;
                        sc = j;
                        found = true;
                        break;
                    }
                }
                if (found)
                    break;
            }
            value[sr][sc] = 1;
            boolean[][] visited = new boolean[n][m];
            LinkedList<Indexing> queue = new LinkedList<>();
            queue.add(new Indexing(sr, sc));
            visited[sr][sc] = true;
            while (queue.size() != 0) {
                Indexing temp = queue.removeFirst();
                for (int i = 0; i < 4; i++) {
                    int x = temp.row + dx[i];
                    int y = temp.col + dy[i];
                    if (check(x, y) && !visited[x][y]) {
                        visited[x][y] = true;
                        value[x][y] = value[temp.row][temp.col] + 1;
                        queue.add(new Indexing(x, y));
                    }
                }
            }
            sr = 0;
            sc = 0;
            int max = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (value[i][j] > max) {
                        max = value[i][j];
                        sr = i;
                        sc = j;
                    }
                }
            }
            visited = new boolean[n][m];
            value = new int[n][m];
            queue.add(new Indexing(sr, sc));
            value[sr][sc] = 1;
            visited[sr][sc] = true;
            while (queue.size() != 0) {
                Indexing temp = queue.removeFirst();
                for (int i = 0; i < 4; i++) {
                    int x = temp.row + dx[i];
                    int y = temp.col + dy[i];
                    if (check(x, y) && !visited[x][y]) {
                        visited[x][y] = true;
                        value[x][y] = value[temp.row][temp.col] + 1;
                        queue.add(new Indexing(x, y));
                    }
                }
            }
            PriorityQueue<Doo> pq = new PriorityQueue<>((a, b) -> b.rank - a.rank);
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (value[i][j] != 0) {
                        Doo change = new Doo();
                        change.indexing = new Indexing(i, j);
                        change.rank = value[i][j];
                        pq.add(change);
                    }
                }
            }
            while (k-- > 0) {
                Doo temp = pq.poll();
                arr[temp.indexing.row].setCharAt(temp.indexing.col, 'X');
            }
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++)
                    out.print(arr[i].charAt(j));
                out.println();
            }
        }

        class Doo {
            Indexing indexing;
            int rank;

        }

        class Indexing {
            int row;
            int col;

            Indexing(int a, int b) {
                row = a;
                col = b;
            }

        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String n() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(n());
        }

    }
}