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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
vector<long long> prime(1000005, 1);
void cal_primearray(long long n) {
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == 1) {
      for (int i = p * 2; i <= n; i += p) prime[i] = 0;
    }
  }
}
long long modexpo(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long expo(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a);
    a = (a * a);
    b >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i += 6) {
    if ((n % i == 0) || (n % (i + 2) == 0)) return false;
  }
  return true;
}
long long max_value(vector<long long> arr) {
  long long m = 0;
  for (int i = 0; i < arr.size(); i++) m = max(m, arr[i]);
  return m;
}
void kmp(string second) {
  vector<long long> v(second.length() + 1, 0);
  long long cur = 0;
  for (int j = 2; j < second.length(); j++) {
    while (cur != 0 && second[cur] != second[j - 1]) cur = v[cur];
    if (second[cur] == second[j - 1]) cur++;
    v[j] = cur;
  }
}
long long nCr(long long n, long long k) {
  if (k == 0) return 1;
  return (n * nCr(n - 1, k - 1)) / k;
}
int dx[] = {2, 2, 1, 1, -1, -1, -2, -2};
int dy[] = {1, -1, 2, -2, 2, -2, 1, -1};
bool myfunc(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first == b.first) return a.second < b.second;
  return (a.first < b.first);
}
vector<string> foo;
set<pair<int, int> > bar;
int vis[500 + 1][500 + 1];
long long k;
bool check(int a, int b, int n, int m) {
  return a < n && a >= 0 && b >= 0 && b < m && (foo[a][b] != '#');
}
void dfs(int x, int y, int n, int m) {
  vis[x][y] = 1;
  for (int i = -1; i <= 1; i++) {
    for (int j = -1; j <= 1; j++) {
      if ((abs(i) != abs(j)) && !vis[x + i][y + j] &&
          check(x + i, y + j, n, m) && k) {
        bar.insert(make_pair(x + i, y + j));
        k--;
        dfs(x + i, y + j, n, m);
      }
    }
  }
}
int main() {
  long long n, m;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    string temp;
    cin >> temp;
    foo.push_back(temp);
  }
  pair<int, int> free;
  int flag = 0;
  int coun = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (foo[i][j] == '#')
        continue;
      else {
        coun++;
        if (flag != 1) free = make_pair(i, j);
        flag = 1;
      }
    }
  }
  bar.insert(make_pair(free.first, free.second));
  k = coun - k - 1;
  dfs(free.first, free.second, n, m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (foo[i][j] == '#')
        continue;
      else if (bar.find(make_pair(i, j)) == bar.end())
        foo[i][j] = 'X';
    }
  }
  for (int i = 0; i < n; i++) cout << foo[i] << "\n";
  return 0;
}