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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class popo {

    public static boolean prime[];
    public static ArrayList[] ad=new ArrayList[2555];
    public static ArrayList<Long> xor1,xor2;
    static int []min;
    static char [][]grid;
    static int []dx = {0,0,-1,1};
    static int []dy = {-1,1,0,0};
    static int count = 0;
    static boolean [][]visit;
    static ArrayList<Integer>[]adj;
    static int[]max ;
    static int [][]khelnacats;
    static int [][]khelnamouse;

    static int n;
    static int m;
    static int total = 0;
    static int save = 0;


    public static void main(String[] args) {

        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

         n = in.nextInt();
         m = in.nextInt();
         visit = new boolean[n][m];
        int k = in.nextInt();
        int dot = 0;
        grid= new char[n][m];
        for (int i = 0 ; i<n;i++)
        {
            String s = in.readString();
            for (int j=0 ; j<m ; j++){

                grid[i][j] = s.charAt(j);
                if(grid[i][j]=='.')
                {
                    dot++;
                }
            }
        }
         save = dot - k;
        for (int i=0 ; i<n ;i++)
        {
            for (int j=0;j<m;j++)
            {
               if(grid[i][j] == '.' && !visit[i][j])
               {
                   dfs(i,j);
                   if(total == save)
                       break;
               }
            }
        }
        for (int i=0;i<n;i++)
        {
            for (int j=0;j<m;j++)
            {
                if(grid[i][j] == 'C')
                    out.print('.');
                if(grid[i][j] == '.')
                    out.print('X');
                if(grid[i][j] == '#')
                    out.print('#');
            }
            out.println();
        }




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

        if(total == save)
            return;
        if(visit[x][y])return;
        visit[x][y] = true;
        total++;
        grid[x][y] = 'C';
        for (int i=0;i<4;i++)
        {
            int x1 = x+dx[i];
            int y1 = y+dy[i];
            if(aaiga(x1, y1))
            {
                dfs(x1,y1);
            }
            if(total == save)
                break;
        }
        if(total == save)
        {
            return;
        }
    }


    public static long modPow(long base, long exp, long mod) {
        base = base % mod;
        long result = 1;
        while(exp > 0)
        {
            if(exp % 2== 1)
            {
                result = (result * base) % mod;
                exp --;
            }
            else
            {
                base = (base * base) % mod;
                exp = exp >> 1;
            }

        }
        return result;
    }

    public static long mod = 1000000007, inf = 100000000000000000l;
    public static long fac[],inv[];
    public static void cal()
    {
        fac = new long[100001];
        inv = new long[100001];
        fac[0]=1;
        inv[0]=1;
        for(int i=1; i<=100000; i++)
        {
            fac[i]=(fac[i-1]*i)%mod;
            //  inv[i]=(inv[i-1]*modPow(i,mod-2,mod))%mod;

        }
    }
    public static long combination(long n, long r)
    {
        long k = (fac[(int) n]%mod*inv[(int) r]%mod)%mod;
        long p = inv[(int) (n-r)]%mod;
        long m = (k*p)%mod;
        return m;
    }


    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return Integer.compare(x, o.x);
        }
    }
    static long setbits(long i)
    {
        long count = 0;
        while (i>0)
        {
            count += i & 1;
            i >>= 1;
        }
        return count;

    }

    static ArrayList<Long> sieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.


        prime=new boolean[1000001];
        for(int i=0;i<n;i++)
            prime[i] = true;

        for(long p = 2; p*p <=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[(int)p] == true)
            {
                // Update all multiples of p
                for(long i = p*2; i <= n; i += p) {
                    prime[(int) i] = false;
                }
            }
        }
        ArrayList<Long> aa=new ArrayList<>();
        for (long i=0;i<n;i++)
        {
            if(prime[(int)i])
                aa.add(i);
        }
        return aa;

        // Print all prime numbers
      /*  for(int i = 2; i <= n; i++)
        {
            if(prime[i] == true)
                System.out.print(i + " ");
        }
       */
    }

    static class coor{
        int x;
        int y;

        public coor(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

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

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}