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

Solution:
import fileinput
#import time



n, m, k = 0, 0, 0
index = 0
ar = list()

for line in fileinput.input():
    if not index:
        n, m, k = line.split(" ")
        n = int(n)
        m = int(m)
        k = int(k)
    else:
        l = list()
        for c in line:
            #print c
            #print ord(c)
            if ord(c) == 10:
                continue
            l.append(True if c == '.' else False)
        ar.append(l)
    index += 1

def handle(ar, k):
    s = list()
    past = set()
    x = -1
    y = -1
    for l in range(0, len(ar)):
        for c in range(0, len(ar[l])):
            if not ar[l][c]:
                continue
            x = l
            y = c
            s.append((x,y,False))
            break
        if x != -1 and y != -1:
            break
    
    while s:
        #print s
        #print past
        #time.sleep(.5)
        if not k:
            return k

        x, y, w = s.pop()

        if not ar[x][y]:
            continue

        if not w:
            s.append((x, y, True))
        
        if w:
            ar[x][y] = None
            k -= 1

        if (x, y) in past:
            #print "IN PAST, CONTINUING"
            continue

        past.add((x, y))
        
        added = 0

        if x > 0:
            if ar[x-1][y] and (x-1, y) not in past:
                s.append((x-1, y, False))
                added += 1
        if x < len(ar) - 1:
            if ar[x+1][y] and (x+1, y) not in past:
                s.append((x+1, y, False))
                added += 1
        if y > 0:
            if ar[x][y-1] and (x, y-1) not in past:
                s.append((x, y-1, False))
                added += 1
        if y < len(ar[x]) - 1:
            if ar[x][y+1] and (x, y+1) not in past:
                s.append((x, y+1, False))
                added += 1
        
        if not added:
            ar[x][y] = None
            k -= 1
            s.pop()

    #k = helper(ar, k, x, y, past)
    
def helper(ar, k, x, y, past):
    if not k:
        return k
    
    if not ar[x][y]:
        return k

    if (x, y) in past:
        return k
    
    past.add((x, y))

    if x > 0:
        k = helper(ar, k, x-1, y, past)
    if x < len(ar) - 1 and k:
        k = helper(ar, k, x+1, y, past)
    if y > 0 and k:
        k = helper(ar, k, x, y-1, past)
    if y < len(ar[x])-1 and k:
        k = helper(ar, k, x, y+1, past)

    if k:
        #print "CHANGING {},{} TO 'X'".format(x, y)
        ar[x][y] = None
        k -= 1

    return k

#print "initialize"

#ar = list()
#for i in range(0, 500):
#    ar.append([True for x in range(0, 500)])

#k = 249999

#print "start"

handle(ar, k)
for l in range(0, len(ar)):
    o = ""
    for c in range(0, len(ar[l])):
        if ar[l][c]:
            o += "."
        elif ar[l][c] is None:
            o += "X"
        else:
            o += "#"
    print o