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.*;
//267630EY
public class Main377A
{
  static PrintWriter out=new PrintWriter(System.out);
  static boolean[][] marked;
  static String[] s;
  static int n;
  static int m;
  static boolean valid(int x,int y)
  {
    return 0<=x&&x<n&&y>=0&&y<m;
  }
  static class pair
  {
    int a;
    int b;
    public pair(int x,int y)
    {
      this.a=x;
      this.b=y;
    }
  }
  static int mk=0;
  static Vector<pair> sol;
  static void dfs(int ro,int lo,int th)
  {
    if((mk!=th))
    {
      
      mk++;
    }
    else
      sol.add(new pair(ro,lo));
    marked[ro][lo]=true;
    
   
    Vector<pair> v=new Vector<pair>();
    if(valid(ro-1,lo)&&s[ro-1].charAt(lo)=='.')
      v.add(new pair(ro-1,lo));
    if(valid(ro+1,lo)&&s[ro+1].charAt(lo)=='.')
      v.add(new pair(ro+1,lo));
    if(valid(ro,lo-1)&&s[ro].charAt(lo-1)=='.')
      v.add(new pair(ro,lo-1));
    if(valid(ro,lo+1)&&s[ro].charAt(lo+1)=='.')
      v.add(new pair(ro,lo+1));
//    ./out.println(v.size());
    for(pair g:v)
    {
     
      if(!marked[g.a][g.b])
        dfs(g.a,g.b,th);
      
    }
    
  }
 
  public static void main(String[] args) throws IOException
  {
    Scanner sc=new Scanner(System.in);
    n=sc.nextInt();
    m=sc.nextInt();
    sol=new Vector<pair>();
    int k=sc.nextInt();
    s=new String[n];
    marked=new boolean[n][m];
    
    for(int i=0;i<n;i++)
      s[i]=sc.next();
    int op=0;
    int ro=0;
    int co=0;
    for(int i=0;i<n;i++)
    {
      for(int j=0;j<s[i].length();j++)
      {
        marked[i][j]=false;
        if(s[i].charAt(j)=='.')
        {
          ro=i;
          co=j;
          
          op++;
        }
      }
    }
   dfs(ro,co,op-k);
   char[][] ans=new char[n][m];
   for(int i=0;i<n;i++)
   {
     ans[i]=s[i].toCharArray();
   }
    for(pair g:sol)
    {
      ans[g.a][g.b]='X';
    }
    
      
   for(int i=0;i<n;i++)
   {
     for(int j=0;j<m;j++)
       out.print(ans[i][j]);
     out.println();
   }
   out.flush();
  
  }
  static class Scanner
  {
    BufferedReader br;
    StringTokenizer tk=new StringTokenizer("");
    public Scanner(InputStream is) 
        {
      br=new BufferedReader(new InputStreamReader(is));
    }
        public int nextInt() throws IOException
        {
          if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
          tk=new StringTokenizer(br.readLine());
          return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
              return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
          if(tk.hasMoreTokens())
            return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
          tk=new StringTokenizer("");
          return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
              return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
              return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        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 long[] nextLongArray(int n) throws IOException
        {
          long a[]=new long[n];
            for(int i=0;i<n;i++)
              a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
          int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
              a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
          long a[]=new long[n+1];
          for(int i=1;i<=n;i++)
                a[i]=nextLong();
          return a;
        }
  }
}