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.*;
import java.util.*;

public class Solution {
    static final int INF = (int) 1e9;
    static final int mod = (int) (1e9 + 7);
    static final short UNCALC = -1;
    static int n, m;
    static char[][] grid;
    static int[] dx = {1, -1, 0, 0};
    static int[] dy = {0, 0, 1, -1};

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        n = sc.nextInt();
        m = sc.nextInt();
        int k = sc.nextInt();
        Cell empty = null;
        grid = new char[n][m];
        for (int i = 0; i < n; i++) {
            grid[i] = sc.next().toCharArray();
            for (int j = 0; j < m; j++)
                if (grid[i][j] == '.') empty = new Cell(i, j);
        }
        bfs(empty, k);
        for (char[] x : grid)
            out.println(new String(x));
        out.flush();
        out.close();
    }

    static void bfs(Cell start, int kk) {
        int[][] level = new int[n][m];
        int max = n * m + 1;
        ArrayList<Cell> adjList[] = new ArrayList[max];
        for (int i = 0; i < max; i++)
            adjList[i] = new ArrayList<>();
        for (int[] a : level)
            Arrays.fill(a, UNCALC);
        level[start.x][start.y] = 0;
        adjList[0].add(start);
        Queue<Cell> q = new LinkedList<>();
        q.add(start);
        while (!q.isEmpty()) {
            Cell cur = q.remove();
            for (int k = 0; k < 4; k++) {
                int xx = cur.x + dx[k];
                int yy = cur.y + dy[k];
                if (!valid(xx, yy) || level[xx][yy] != -1) continue;
                level[xx][yy] = level[cur.x][cur.y] + 1;
                q.add(new Cell(xx, yy));
                adjList[level[xx][yy]].add(new Cell(xx, yy));
            }
        }
        all:
        for (int i = max - 1; i >= 0; i--) {
            if (adjList[i].size() == 0) continue;
            for (int j = 0; j < adjList[i].size(); j++) {
                if (kk == 0) break all;
                kk--;
                Cell now = adjList[i].get(j);
                grid[now.x][now.y] = 'X';
            }
        }
    }

    static boolean valid(int x, int y) {
        return x >= 0 && x < n && y >= 0 && y < m && grid[x][y] == '.';
    }

    static class Cell {
        int x, y;

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

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        public Scanner(String file) throws Exception {
            br = new BufferedReader(new FileReader(file));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

        public void waitForInput() throws InterruptedException {
            Thread.sleep(3000);
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }
}