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

public class Main implements Runnable {

    int n, m, kk;
    char[][] board;
    boolean[][] visited;
    int[] x = new int[]{1, 0, -1, 0};
    int[] y = new int[]{0, 1, 0, -1};

    public void solve() throws IOException {
        n = nextInt();
        m = nextInt();
        kk = nextInt();
        board = new char[n][m];
        visited = new boolean[n][m];
        for (int i = 0; i < n; i++) {
            String s = nextToken();
            for (int j = 0; j < m; j++) {
                board[i][j] = s.charAt(j);
            }
        }
        /*
         outer:
         for (int k = 0; k < kk; k++) {
         boolean done = false;
         int minDeg = 1;
         for (int i = 0; i < n; i++) {
         if (done) {
         break;
         }
         for (int j = 0; j < m; j++) {
         if (done) {
         break;
         }
         if (board[i][j] == '.') {
         int deg = 0;
         if (i - 1 >= 0 && board[i - 1][j] == '.') {
         deg++;
         }
         if (j - 1 >= 0 && board[i][j - 1] == '.') {
         deg++;
         }
         if (i + 1 < n && board[i + 1][j] == '.') {
         deg++;
         }
         if (j + 1 < m && board[i][j + 1] == '.') {
         deg++;
         }
         // System.out.println(i + " " + j + " :" + deg);
         if (deg == minDeg) {
         board[i][j] = 'X';
         done = true;
         continue outer;
         }
         }
         }
         }
         // System.out.println(minDeg);
         if (!done) {
         minDeg++;
         k--;
         }
         }
         */
        boolean done = false;
        for (int i = 0; i < n && !done; i++) {
            for (int j = 0; j < m; j++) {
                if (board[i][j] == '.') {
                    dfs(i, j);
                    done = true;
                    break;
                }
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                System.out.print(board[i][j]);
            }
            System.out.println();
        }
    }

    void dfs(int ind1, int ind2) {
        //if (ind1 < 0 || ind2 < 0 || ind1 >= n || ind2 >= m) {
        //    return;
        //}
        visited[ind1][ind2] = true;
        for (int i = 0; i < 4; i++) {
            int i1 = ind1 + x[i];
            int i2 = ind2 + y[i];
            if (valid(i1, i2) && board[i1][i2] == '.' && !visited[i1][i2]) {
                dfs(i1, i2);
            }
        }
        if (kk > 0) {
            board[ind1][ind2] = 'X';
            kk--;
        }

    }

    boolean valid(int i1, int i2) {
        return i1 >= 0 && i1 < n && i2 >= 0 && i2 < m;
    }

    int solveit(int n, int[] a1, int[] a2) {
        a1 = a1.clone();
        for (int i = 0; i < n; ++i) {
            if (a2[i] >= 0) {
                merge(a1, i, a2[i]);
            }
        }
        int res = 0;
        for (int x : a1) {
            if (x < 0) {
                ++res;
            }
        }
        return res;
    }

    void merge(int[] comps, int a, int b) {
        a = get(comps, a);
        b = get(comps, b);
        if (a != b) {
            comps[a] = b;
        }
    }

    int get(int[] comps, int x) {
        if (comps[x] < 0) {
            return x;
        }
        comps[x] = get(comps, comps[x]);
        return comps[x];
    }

    void shuffle(int[] a) {
        int N = a.length;
        for (int i = 0; i < N / 2; i++) {
            int j = (int) (Math.random() * N);
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
    }

    void print(int[] a) {
        System.out.println();
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i] + " ");
        }
    }

    void print(int[][] arr) {
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }

    boolean nextPermutation(int[] arr) {
        int f = -1;
        for (int i = arr.length - 2; i >= 0; i--) {
            if (arr[i + 1] > arr[i]) {
                f = i;
                break;
            }
        }
        if (f == -1) {
            return false;
        }
        int s = -1;
        for (int i = arr.length - 1; i >= 0; i--) {
            if (arr[i] > arr[f]) {
                s = i;
                break;
            }
        }
        int d = arr[f];
        arr[f] = arr[s];
        arr[s] = d;

        f++;
        int l = arr.length - 1;
        while (f < l) {
            d = arr[f];
            arr[f] = arr[l];
            arr[l] = d;
            f++;
            l--;
        }
        return true;
    }

    //-----------------------------------------------------------
    public static void main(String[] args) {
        new Main().run();
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            tok = null;
            solve();
            in.close();
        } catch (IOException e) {
            System.exit(0);
        }
    }

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

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

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

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    BufferedReader in;
    StringTokenizer tok;
}