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

Solution:
import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
from queue import Queue
n,m,k=0,0,0
#distance=[]
mtrx=[]
visited=[]
count=0
def check(u,v):
    global n,m,mtrx
    if (u<0 or u>n-1 or v<0 or v>m-1):
        return False
    if (visited[u][v]==1 or mtrx[u][v]=='#'):
        return False
    return True
ldx=[-1,0,1,0]
ldy=[0,1,0,-1]
def bfs(sx,sy):
    global mtrx,visited,count,k
    q=Queue()
    #l=[]
    #l.append((sx,sy))
    q.put((sx,sy))
    visited[sx][sy]=1
    mtrx[sx][sy]='.'
    ll=1
    #distance[sx][sy]=0
    #print(l)
    while not q.empty():#len(l):
        a,b=q.get()#l[0][0],l[0][1]
        #l.pop(0)
        #print(l)
        for i in range(4):
            if check(a+ldx[i],b+ldy[i]):
                na,nb=a+ldx[i],b+ldy[i]
                #l.append((na,nb))
                q.put((na,nb))
                visited[na][nb]=1
                mtrx[na][nb]='.'
                ll+=1
                #distance[na][nb]=distance[a][b]+1   
            if ll==(count-k):
                break
        if ll==(count-k):
                break        
                
def main():
    global n,m,k,visited,mtrx,count
    n,m,k=map(int,input().split())
    if k==0:
        for i in range(n):
            print(input())
    else:        
        #distance=[[-1 for j in range(m)]for i in range(n)]
        visited=[[0 for j in range(m)]for i in range(n)]
        mtrx=[]
        count=0
        for i in range(n):
            l=[]
            l=list(input().replace('.','X'))
            count+=l.count('X')
            
            mtrx.append(l)
        xx=yy=0            
        for i in range(n):
            if 'X' in mtrx[i]:
                xx,yy=i,mtrx[i].index('X')
                break         
        bfs(xx,yy)
        for i in mtrx:
            print(''.join(i))   
main()