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

/**
 * Created with IntelliJ IDEA.
 * User: AUtemuratov
 * Date: 07.04.14
 * Time: 15:43
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    static FastReader fr = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter pw = new PrintWriter(System.out);
    static int max = Integer.MIN_VALUE;
    static int min = Integer.MAX_VALUE;
    static long n,m,k,cnt;
    static int maxn = (int)1e3 + 111;
    static char c[][] = new char[maxn][maxn];
    static boolean u[][] = new boolean[maxn][maxn];

    public static void main(String[] args) throws Exception {

        n = fr.nextInt();
        m = fr.nextInt();
        k = fr.nextInt();

        String s;

        for (int i=0; i<=n; i++) {
            c[i][0] = ' ';
            c[0][i] = ' ';
        }

        for (int i=1; i<=n; i++) {
            s = fr.nextToken();
            for (int j=0; j<m; j++) {
                c[i][j+1] = s.charAt(j);
            }
        }

        Pair p = new Pair(-1,-1);
        for (int i=1; i<=n; i++) {
            for (int j=1; j<=m; j++) {
                if (c[i][j]=='.') {
                    p.x = i;
                    p.y = j;
                }
            }
        }

        dfs(p.x,p.y);

        for (int i=1; i<=n; i++) {
            for (int j=1; j<=m; j++) {
                pw.print(c[i][j]);
            }
            pw.println();
        }

        pw.close();
    }

    private static void dfs(int x,int y) {
        u[x][y] = true;

        if (c[x-1][y]=='.' && !u[x-1][y]) {
            dfs(x-1,y);
            if (cnt<k) {
                c[x-1][y] = 'X';
                cnt++;
            }
        }

        if (c[x][y-1]=='.' && !u[x][y-1]) {
            dfs(x,y-1);
            if (cnt<k) {
                c[x][y-1] = 'X';
                cnt++;
            }
        }

        if (c[x+1][y]=='.' && !u[x+1][y]) {
            dfs(x+1,y);
            if (cnt<k) {
                c[x+1][y] = 'X';
                cnt++;
            }
        }

        if (c[x][y+1]=='.' && !u[x][y+1]) {
            dfs(x,y+1);
            if (cnt<k) {
                c[x][y+1] = 'X';
                cnt++;
            }
        }
    }
}


class Pair implements Comparable<Pair>{
    int x,y;
    public Pair (int x, int y) {
        this.x = x;
        this.y = y;
    }
    @Override
    public int compareTo(Pair p) {
        if (this.x>p.x) return 1;
        else if (this.x==p.x)return 0;
        else if (this.x<p.x) return -1;
        return 0;
    }
}

class FastReader {

    BufferedReader bf;
    StringTokenizer tk = null;
    String DELIM = " ";

    public FastReader(BufferedReader bf) {
        this.bf = bf;
    }

    public String nextToken() throws Exception {

        if(tk==null || !tk.hasMoreTokens()) {
            tk = new StringTokenizer(bf.readLine(),DELIM);
        }
        return tk.nextToken();
    }

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

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

    public int nextDouble() throws Exception {
        return Integer.parseInt(nextToken());
    }
}