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;
long long int MOD = 998244353;
long long int mod = 1e9 + 7;
const int N = 101;
int visited[N];
vector<long long int> grph[N];
long long int level[N];
long long int parent[N];
int dist[N];
long long int pred[N];
void dfs(int curr) {
  visited[curr] = 1;
  for (auto i : grph[curr]) {
    if (visited[i] == 1) {
      continue;
    }
    dfs(i);
  }
}
bool bfs(long long int x, long long int dest) {
  queue<long long int> q;
  q.push(x);
  while (!q.empty()) {
    long long int curr = q.front();
    q.pop();
    for (auto z : grph[curr]) {
      if (visited[z] == 0) {
        visited[z] = 1;
        dist[z] = dist[curr] + 1;
        pred[z] = curr;
        q.push(z);
        if (z == dest) return true;
      } else
        continue;
    }
  }
  return false;
}
bool comp(const pair<long long int, long long int> &a,
          const pair<long long int, long long int> &b) {
  if (abs(a.first) == abs(b.first))
    return (abs(a.second) < abs(b.second));
  else
    return (abs(a.first) < abs(b.first));
}
long long int find(long long int x) {
  if (parent[x] == x)
    return x;
  else
    return parent[x] = find(parent[x]);
}
long long int modinverse(long long int a, long long int m) {
  long long int m0 = MOD;
  long long int y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long int q = a / m;
    long long int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
unsigned long long power(unsigned long long x, long long int y,
                         long long int p) {
  unsigned long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
unsigned long long modInverse(unsigned long long n, int p) {
  return power(n, p - 2, p);
}
unsigned long long nCrModPFermat(unsigned long long n, int r, int p) {
  if (r == 0) return 1;
  unsigned long long fac[n + 1];
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
long long factorial(int n) {
  const unsigned int M = 1000000007;
  unsigned long long f = 1;
  for (int i = 1; i <= n; i++) f = ((f % M) * (i % M)) % M;
  return f;
}
long long int k, n, m, cnt0 = 0;
string s[511];
long long int vis[501][501];
bool isValid(long long int x, long long int y) {
  if (x < 0 || y < 0 || x > n - 1 || y > m - 1 || s[x][y] == '#' ||
      vis[x][y] == 1)
    return false;
  else
    return true;
}
void bfs2(long long int x, long long int y) {
  long long int i, j;
  if (isValid(x, y)) {
    vis[x][y] = 1;
    k--;
    if (k < 0) return;
    bfs2(x - 1, y);
    bfs2(x + 1, y);
    bfs2(x, y + 1);
    bfs2(x, y - 1);
    s[x][y] = '.';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int tt;
  tt = 1;
  while (tt--) {
    long long int pos2 = -1, pos1 = -1, l, p, q, i, j, ans = 0, res = 0,
                  cnt = 0, cnt1 = 0, f = 0, sum = 0, minn = INT_MAX,
                  maxx = INT_MIN;
    cin >> n >> m >> k;
    for (int i = int(0); i < int(n); i++) cin >> s[i];
    if (k == 0) {
      for (int i = int(0); i < int(n); i++) {
        cout << s[i];
        cout << "\n";
      }
      continue;
    }
    vector<pair<long long int, long long int>> v;
    for (int i = int(0); i < int(n); i++) {
      for (int j = int(0); j < int(m); j++) {
        if (s[i][j] == '.') {
          cnt0++;
          s[i][j] = 'X';
          v.emplace_back(i, j);
        }
      }
    }
    k = cnt0 - k;
    res = k;
    for (int i = int(0); i < int(v.size()); i++) {
      bfs2(v[i].first, v[i].second);
      if (k < 0)
        break;
      else
        k = res;
    }
    for (int i = int(0); i < int(n); i++) {
      cout << s[i];
      cout << "\n";
    }
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}