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.StringTokenizer;



import java.io.*;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.io.OutputStream;

public class Main{
    public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outStream);
        TaskA solver = new TaskA();
        solver.solve(1,in,out);
        out.close();
    }
}
class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int rowCount = in.nextInt();
        int columnCount = in.nextInt();
        int fill = in.nextInt();
        char[][] map = new char[rowCount][columnCount];
        for(int i=0;i<rowCount;i++){
            String line = in.next();
            for(int j =0;j<line.length();j++){
                map[i][j]=line.charAt(j);
            }
        }

        int size = 0;
        int[] rowQueue = new int[rowCount*columnCount];
        int[] colQueue = new int[rowCount*columnCount];
        for(int i=0;i<rowCount && size==0;i++){
            for(int j=0;j<columnCount && size==0;j++){
                if(map[i][j]=='.'){
                    rowQueue[0]=i;
                    colQueue[0]=j;
                    map[i][j]='X';
                    size = 1;
                }
            }
        }

        int[] dx = {1,0,-1,0};
        int[] dy = {0,1,0,-1};

        for(int i=0;i<size;i++){
            int row = rowQueue[i];
            int col = colQueue[i];
            for(int j=0;j<4;j++){
                int nRow = row+dx[j];
                int nColumn = col+dy[j];
                if(ok(nRow,nColumn,rowCount,columnCount)&&map[nRow][nColumn]=='.'){
                    map[nRow][nColumn] = 'X';
                    rowQueue[size] = nRow;
                    colQueue[size++] = nColumn;
                }
            }
        }

        for(int i=0;i<size-fill;i++){
            map[rowQueue[i]][colQueue[i]]='.';
        }

        for(char[] row:map){
            out.printLine(new String(row));
        }


    }

    boolean ok(int row, int col, int rowLen, int colLen){
        return(row >=0 && col>=0 && row<rowLen && col<colLen);
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public InputReader(File f) throws FileNotFoundException {
        reader = new BufferedReader(new FileReader(f));
        tokenizer = null;
    }
    public String next(){
        String str = null;
        while ((tokenizer == null || !tokenizer.hasMoreTokens())) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }


    public char[] nextChar() {
        try {
            return reader.readLine().toCharArray();
        } catch (IOException e) {
            e.printStackTrace();
            //TODO: optimise return value for error case
            return null;
        }
    }

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

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(File f) throws IOException{
        writer = new PrintWriter(new FileWriter(f));
    }

    public void close() {
        writer.close();
    }

    public void printLine(long i) {
        writer.println(i);
    }

    public void printLine(String str){
        writer.println(str);
    }

}


class IOUtils {

    public static char[] readCharArray(InputReader in, int size) {
        char[] array = new char[size];
        array = in.nextChar();
        return array;
    }

    public static char[][] readTable(InputReader in, int rowCount, int columnCount) {
        char[][] table = new char[rowCount][];
        for (int i = 0; i < rowCount; i++)
            table[i] = readCharArray(in, columnCount);
        return table;
    }

}