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:
n, m, k = [int(i) for i in input().split()]

maze = []
for row in range (n):
    ro = []
    temp = input()
    for i in temp:
        if i == '.':
            ro.append(1)

        else:
            ro.append(0)
    maze.append(ro)
# print(maze)
done = 0
for i in range (n):
    if done == 1:
        break
    for j in range (m):
        if maze[i][j] == 1:
            root_node = [i, j]
            done = 1
            break

visited = [[0 for i in range (m)] for j in range (n)]

visited[root_node[0]][root_node[1]] = 1

levels = []
levels.append([root_node])
# print(root_node)

stop = 0
while True:
    if stop == 1:
        break

    else:
        bottom_most_nodes = levels[-1]
        upcoming_nodes = []
        
        for node in bottom_most_nodes:
            i, j = node[0], node[1]
            if i == 0:
                if j == 0:
                    for row, col in [[min(i+1, n-1), j], [i, min(j+1, m-1)]]:
                        if maze[row][col] == 1 and visited[row][col] == 0:
                            upcoming_nodes.append([row, col])
                            visited[row][col] = 1

                elif j == m-1:
                    for row, col in [[min(i+1, n-1), j], [i, max(j-1, 0)]]:
                        if maze[row][col] == 1 and visited[row][col] == 0:
                            upcoming_nodes.append([row, col])
                            visited[row][col] = 1

                else:
                    for row, col in [[min(i+1, n-1), j], [i, min(j+1, m-1)], [i, max(j-1, 0)]]:
                        if maze[row][col] == 1 and visited[row][col] == 0:
                            upcoming_nodes.append([row, col])
                            visited[row][col] = 1

            elif i == n-1:
                if j == 0:
                    for row, col in [[max(i-1, 0), j], [i, min(j+1, m-1)]]:
                        if maze[row][col] == 1 and visited[row][col] == 0:
                            upcoming_nodes.append([row, col])
                            visited[row][col] = 1

                elif j == m-1:
                    for row, col in [[max(i-1, 0), j], [i, max(j-1, 0)]]:
                        if maze[row][col] == 1 and visited[row][col] == 0:
                            upcoming_nodes.append([row, col])
                            visited[row][col] = 1

                else:
                    for row, col in [[max(i-1, 0), j], [i, min(j+1, m-1)], [i, max(j-1, 0)]]:
                        if maze[row][col] == 1 and visited[row][col] == 0:
                            upcoming_nodes.append([row, col])
                            visited[row][col] = 1

            else:
                if j == 0:
                    for row, col in [[max(i-1, 0), j], [min(i+1, n-1), j], [i, min(j+1, m-1)]]:
                        if maze[row][col] == 1 and visited[row][col] == 0:
                            upcoming_nodes.append([row, col])
                            visited[row][col] = 1

                elif j == m-1:
                    for row, col in [[min(i+1, n-1), j], [max(i-1, 0), j], [i, max(j-1, 0)]]:
                        if maze[row][col] == 1 and visited[row][col] == 0:
                            upcoming_nodes.append([row, col])
                            visited[row][col] = 1

                else:
                    for row, col in [[min(i+1, n-1), j], [i, min(j+1, m-1)], [max(i-1, 0), j], [i, max(j-1, 0)]]:
                        if maze[row][col] == 1 and visited[row][col] == 0:
                            upcoming_nodes.append([row, col])
                            visited[row][col] = 1

        if upcoming_nodes == []:
            stop = 1
            break

        else:
            levels.append(upcoming_nodes)


final_arcitect = []
for i in maze:
    temp = []
    for j in i:
        temp.append(j)
    
    final_arcitect.append(temp)

remaining = k
while (remaining > 0):
    current_level = levels.pop(-1)
    if len(current_level) <= remaining:
        for j in current_level:
            maze[j[0]][j[1]] = -1
        
        remaining -= len(current_level)
    else:
        for j in range (remaining):
            maze[current_level[j][0]][current_level[j][1]] = -1

        remaining = 0

for i in range (n):
    line = ''
    for j in range (m):
        if maze[i][j] == 1:
            line += '.'
        elif maze[i][j] == 0:
            line += '#'
        else:
            line += 'X'
    print(line)
# for lev in levels:
#     print(lev)