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
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__

def getInts():
    return [int(s) for s in input().split()]
    
def getInt():
    return int(input())

def getStrs():
    return [s for s in input().split()]

def getStr():
    return input()

def listStr():
    return list(input())

import collections as c

def solve():
    N, M, K = getInts()
    maze = []
    for n in range(N):
        maze.append(listStr())
    graph = c.defaultdict(set)
    first_flag = False
    empty_count = 0
    if K == 0:
        for n in range(N):
            print(''.join(maze[n]))
        return
    for n in range(N):
        for m in range(M):
            if maze[n][m] == '#':
                continue
            empty_count += 1
            if not first_flag:
                first_n, first_m = n, m
            first_flag = True
            if n > 0 and maze[n-1][m] != '#':
                graph[(n,m)].add((n-1,m))
            if n < N-1 and maze[n+1][m] != '#':
                graph[(n,m)].add((n+1,m))
            if m > 0 and maze[n][m-1] != '#':
                graph[(n,m)].add((n,m-1))
            if m < M-1 and maze[n][m+1] != '#':
                graph[(n,m)].add((n,m+1))
            assert(len(graph[(n,m)]) > 0)
    #bfs starting from (first_n, first_m), stopping when node count reaches S-K
        
    def bfs(graph,visited,node,queue,visited_dict,max_nodes):
        visited.append(node)
        visited_dict[node] = 1
        count = 0
        queue.append(node)
        queue = c.deque(queue)
        if len(visited) == max_nodes:
            return
        while queue:
            #be careful: this pop(0) can be slow. Consider using a deque
            s = queue.popleft()
            for neighbour in graph[s]:
                if neighbour not in visited_dict:
                    visited.append(neighbour)
                    visited_dict[neighbour] = 1
                    if len(visited) == max_nodes:
                        return
                    queue.append(neighbour)
        return
    visited = []
    visited_dict = c.defaultdict(int)
    bfs(graph,visited,(first_n,first_m),[],visited_dict,empty_count-K)
    for n in range(N):
        for m in range(M):
            if maze[n][m] != '#':
                if (n,m) not in visited_dict:
                    maze[n][m] = 'X'
    for n in range(N):
        print(''.join(maze[n]))
    return

solve()