DZY loves chessboard, and he enjoys playing with it.

He has a chessboard of n rows and m columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white or black. After putting all chessmen, DZY wants that no two chessmen with the same color are on two adjacent cells. Two cells are adjacent if and only if they share a common edge.

You task is to find any suitable placement of chessmen on the given chessboard.


-----Input-----

The first line contains two space-separated integers n and m (1 ≤ n, m ≤ 100).

Each of the next n lines contains a string of m characters: the j-th character of the i-th string is either "." or "-". A "." means that the corresponding cell (in the i-th row and the j-th column) is good, while a "-" means it is bad.


-----Output-----

Output must contain n lines, each line must contain a string of m characters. The j-th character of the i-th string should be either "W", "B" or "-". Character "W" means the chessman on the cell is white, "B" means it is black, "-" means the cell is a bad cell.

If multiple answers exist, print any of them. It is guaranteed that at least one answer exists.


-----Examples-----
Input
1 1
.

Output
B

Input
2 2
..
..

Output
BW
WB

Input
3 3
.-.
---
--.
Output
B-B
---
--B


-----Note-----

In the first sample, DZY puts a single black chessman. Of course putting a white one is also OK.

In the second sample, all 4 cells are good. No two same chessmen share an edge in the sample output.

In the third sample, no good cells are adjacent. So you can just put 3 chessmen, no matter what their colors are.

Difficulty: EASY
Tags: Graph traversal

Implementation

Starter code:

Solutions:
(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	o = ''
	for j in range(m):
		if s[j] == '.':
			if (i + j) % 2 == 0:
				o += 'B'
			else:
				o += 'W'
		else:
			o += s[j]
	print(o)


(n, m) = map(int, input().split())
ans = []
for i in range(n):
	z = input()
	ans.append(z)
t1 = []
t2 = []
flag = 0
dp = []
for i in range(m):
	if flag == 0:
		t1.append('B')
		t2.append('W')
		flag = 1
	else:
		t1.append('W')
		t2.append('B')
		flag = 0
for i in range(n):
	if i % 2 == 0:
		dp.append(t1.copy())
	else:
		dp.append(t2.copy())
for i in range(n):
	mn = ans[i]
	for j in range(m):
		if mn[j] == '-':
			dp[i][j] = '-'
for i in range(n):
	print(''.join(map(str, dp[i])))


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, m) = get_ints()
mat = []
for i in range(n):
	mat.append(list(input()))
for i in range(n):
	for j in range(m):
		if mat[i][j] == '.':
			if i + j & 1:
				mat[i][j] = 'W'
			else:
				mat[i][j] = 'B'
for i in mat:
	print(''.join(i))


(n_lines, n_columns) = list(map(int, input().split()))
for i in range(n_lines):
	line = list(input())
	for j in range(n_columns):
		if line[j] == '.':
			if i % 2 == j % 2:
				line[j] = 'B'
			else:
				line[j] = 'W'
	print(''.join(line))


Char = 'WB'
Index = 0
First = 0
X = list(map(int, input().split()))
Sentence = []
for i in range(X[0]):
	Index = (First + 1) % 2
	Temp = list(input())
	for j in range(X[1]):
		if Temp[j] == '.':
			Temp[j] = Char[Index]
		Index = (Index + 1) % 2
	Sentence.append(Temp)
	First = (First + 1) % 2
for i in range(X[0]):
	print(*Sentence[i], sep='')


(a, b) = input().split(' ')
x = []
i = 0
while i < int(a):
	c = input()
	j = 0
	x.insert(i, c)
	i += 1
i = 0
y = []
e = int(b)
d = 0
i = 0
A = ''
B = x[0]
while i < int(a):
	j = 0
	d = 0
	B = x[i]
	A = ''
	if i % 2 == 0:
		d += 1
	while j < e:
		if B[j] != '.':
			A = A + B[j]
		elif (j + d) % 2 == 0:
			A = A + 'B'
		else:
			A = A + 'W'
		j += 1
	y.insert(i, A)
	print(y[i])
	i += 1


(n, m) = map(int, input().split())
d = n * m
b = []
for i in range(n):
	c = list(input())
	for j in c:
		b.append(j)
prev = 'W'

def swap():
	global prev
	if prev == 'B':
		prev = 'W'
	else:
		prev = 'B'
for i in range(d):
	if i % m == 0 and i != 0:
		print()
		if not m & 1:
			swap()
	if b[i] == '-':
		print('-', end='')
		swap()
	else:
		swap()
		print(prev, end='')
print()


(n, m) = map(int, input().split())
x = 'WB'
for row in range(n):
	col = input()
	res = ''
	for c in range(len(col)):
		res += '-' if col[c] == '-' else x[(row + c) % 2]
	print(''.join(res))


(n, m) = map(int, input().split())
a = 'WB'
for i in range(n):
	s = list(input())
	for j in range(m):
		if s[j] == '.':
			s[j] = a[(i + j) % 2]
	for j in range(m):
		print(s[j], end='')
	print()


(n, m) = map(int, input().split())
mat = []
for i in range(n):
	a = input()
	aa = []
	for j in a:
		aa.append(j)
	mat.append(aa)
for i in range(n):
	for j in range(m):
		if mat[i][j] == '.':
			if i % 2:
				if j % 2:
					mat[i][j] = 'W'
				else:
					mat[i][j] = 'B'
			elif j % 2:
				mat[i][j] = 'B'
			else:
				mat[i][j] = 'W'
for i in mat:
	str = ''
	for j in i:
		str += j
	print(str)


(n, m) = map(int, input().split())
colors = ['B', 'W']
for i in range(n):
	line = input()
	for j in range(m):
		if line[j] == '-':
			print('-', end='')
		else:
			print(colors[(i + j) % 2], end='')
	print()


(n, m) = map(int, input().split())
graph = [''] * n
for i in range(n):
	graph[i] = list(input())

def bfs(start):
	global graph
	(layer, flag) = ({start}, False)
	while layer:
		next_layer = set()
		for node in layer:
			(i, j) = node
			if j > 0 and graph[i][j - 1] == '.':
				graph[i][j - 1] = 'B' if flag else 'W'
				next_layer.add((i, j - 1))
			if j < m - 1 and graph[i][j + 1] == '.':
				graph[i][j + 1] = 'B' if flag else 'W'
				next_layer.add((i, j + 1))
			if i > 0 and graph[i - 1][j] == '.':
				graph[i - 1][j] = 'B' if flag else 'W'
				next_layer.add((i - 1, j))
			if i < n - 1 and graph[i + 1][j] == '.':
				graph[i + 1][j] = 'B' if flag else 'W'
				next_layer.add((i + 1, j))
		(layer, flag) = (next_layer, not flag)
for i in range(n):
	for j in range(m):
		if graph[i][j] == '.':
			graph[i][j] = 'B'
			bfs((i, j))
print('\n'.join((''.join(row) for row in graph)))


(n, m) = map(int, input().split())
if n < 1 or m > 100:
	exit(0)
(mas, board) = ([], list())
for i in range(n):
	mas.append([])
	board.append([])
	long = input()
	for j in range(m):
		mas[i].append(long[j])
		if long[j] == '.':
			even = (i + j) % 2
			if even == 0:
				board[i].append('B')
			else:
				board[i].append('W')
		else:
			board[i].append(long[j])
for i in range(n):
	for j in range(m):
		print(board[i][j], end='')
	print()


(n, m) = map(int, input().split())
mat = []
for i in range(n):
	s = input()
	mat.append(s)
d = 1
for i in range(n):
	c = 1
	for j in range(m):
		if mat[i][j] == '-':
			print('-', end='')
		elif d == 1:
			if c % 2 == 0:
				print('B', end='')
			else:
				print('W', end='')
		elif c % 2 == 0:
			print('W', end='')
		else:
			print('B', end='')
		c += 1
	d = d ^ 1
	print()


(n, m) = map(int, input().split())
mat = []
for i in range(n):
	row = input()
	x = ''
	for j in range(m):
		if row[j] == '.':
			x += 'B' if (i + j) % 2 == 0 else 'W'
		else:
			x += '-'
	mat.append(x)
print('\n'.join(mat))


(n, m) = map(int, input().split())
arr = []
for _ in range(n):
	arr.append(list(input()))
it = 1
it1 = 1
for i in range(n):
	for j in range(m):
		if arr[i][j] == '.':
			if i % 2 == 0:
				if j % 2 == 0:
					arr[i][j] = 'W'
				else:
					arr[i][j] = 'B'
			elif j % 2 == 0:
				arr[i][j] = 'B'
			else:
				arr[i][j] = 'W'
for i in range(n):
	for j in range(m):
		print(arr[i][j], end='')
	print('')


(n, m) = map(int, input().split())
for i in range(n):
	a = input()
	for j in range(m):
		if a[j] == '-':
			print(a[j], end='')
		elif (j + i) % 2 == 0:
			print('B', end='')
		else:
			print('W', end='')
	print('')


(n, m) = map(int, input().split())
x = []
for i in range(n):
	x.append(list(input()))
for i in range(n):
	for j in range(m):
		if x[i][j] == '.':
			if i % 2 == 0:
				if j % 2 == 0:
					x[i][j] = 'W'
				else:
					x[i][j] = 'B'
			elif j % 2 == 0:
				x[i][j] = 'B'
			else:
				x[i][j] = 'W'
for i in x:
	print(''.join(i))


(n, m) = map(int, input().split(' '))
g = []
for i in range(n):
	g.append(list(input()))
for i in range(n):
	for j in range(m):
		if (i + j) % 2 and g[i][j] != '-':
			g[i][j] = 'B'
		elif (i + j) % 2 == 0 and g[i][j] != '-':
			g[i][j] = 'W'
for i in range(n):
	print(''.join(g[i]))


(n, m) = input().split()
(n, m) = [int(n), int(m)]
a = []
for i in range(0, n):
	a.append(list(input()))
a = list(a)
if m % 2 == 0:
	for i in range(0, n):
		if i % 2 == 0:
			c = 0
		else:
			c = 1
		for j in range(0, m):
			if a[i][j] == '.':
				if c % 2 == 0:
					a[i][j] = 'B'
				else:
					a[i][j] = 'W'
			c += 1
else:
	c = 0
	for i in range(0, n):
		for j in range(0, m):
			if a[i][j] == '.':
				if c % 2 == 0:
					a[i][j] = 'B'
				else:
					a[i][j] = 'W'
			c += 1
for i in range(0, n):
	print(*a[i], sep='')


def solve():
	from collections import deque
	nm = input().split()
	n = int(nm[0])
	m = int(nm[1])
	good = [[False for _ in range(m)] for _ in range(n)]
	visited = [[False for _ in range(m)] for _ in range(n)]
	color = [['-' for _ in range(m)] for _ in range(n)]
	for i in range(n):
		line = list(input())
		for j in range(m):
			if line[j] == '.':
				good[i][j] = True
	q = deque()
	q.append([0, 0])
	cur_color = 'W'
	color[0][0] = cur_color
	while q:
		cur = q.popleft()
		cur_color = 'B' if color[cur[0]][cur[1]] == 'W' else 'W'
		visited[cur[0]][cur[1]] = True
		r = [-1, 0, 0, 1]
		c = [0, 1, -1, 0]
		for i in range(4):
			adj = [cur[0] + r[i], cur[1] + c[i]]
			if adj[0] < 0 or adj[0] >= n or adj[1] < 0 or (adj[1] >= m):
				continue
			if not visited[adj[0]][adj[1]]:
				visited[adj[0]][adj[1]] = True
				q.append(adj)
				color[adj[0]][adj[1]] = cur_color
	for i in range(n):
		for j in range(m):
			if not good[i][j]:
				color[i][j] = '-'
			print(color[i][j], end='')
		print('')
solve()


rc = input()
rc = rc.split()
rc = [int(i) for i in rc]
store = [[0 for x in range(rc[1])] for y in range(rc[0])]
lister = ['B', 'W']
for i in range(rc[0]):
	line = input()
	line.split()
	for j in range(rc[1]):
		store[i][j] = line[j]
		if i % 2 == 0:
			lister = ['B', 'W']
		else:
			lister = ['W', 'B']
		if line[j] == '.':
			index = j % 2
			store[i][j] = lister[index]
		print(store[i][j], end='')
	print('\n')


(n, m) = map(int, input().split())
l = [list(input()) for _ in range(n)]
for i in range(n):
	for j in range(m):
		if l[i][j] == '.':
			if (i + j) % 2:
				l[i][j] = 'B'
			else:
				l[i][j] = 'W'
print('\n'.join(map(''.join, l)))


(n, m) = [int(x) for x in input().split()]
board = []
for i in range(n):
	a = list(input())
	board.append(a)
for i in range(n):
	for j in range(m):
		if board[i][j] == '.':
			if i % 2 == j % 2:
				board[i][j] = 'B'
			else:
				board[i][j] = 'W'
for each in board:
	print(''.join(each))


from math import *
from collections import *
from sys import *
t = stdin.readline
p = stdout.write

def GI():
	return map(int, t().strip().split())

def GS():
	return map(str, t().strip().split())

def IL():
	return list(map(int, t().strip().split()))

def SL():
	return list(map(str, t().strip().split()))
(n, m) = GI()
c = [SL() for _ in range(n)]
x1 = ''.join(['BW' for _ in range(m)])
x2 = ''.join(['WB' for _ in range(m)])
for i in range(n):
	for j in range(m):
		if i % 2 == 0:
			if c[i][0][j] == '.':
				p(x1[j])
			else:
				p(c[i][0][j])
		elif c[i][0][j] == '.':
			p(x2[j])
		else:
			p(c[i][0][j])
	p('\n')


(r, c) = map(int, input().split())
g = []
for _ in range(r):
	g.append(list(input()))
for ri in range(r):
	for ci in range(c):
		if g[ri][ci] == '-':
			continue
		cm = 1
		if (ri + 1) % 2 == 0:
			cm *= -1
		if (ci + 1) % 2 == 0:
			cm *= -1
		g[ri][ci] = 'B' if cm == 1 else 'W'
	print(''.join(g[ri]))


(n, m) = map(int, input().split(' '))
og_mat = [list(input()) for x in range(n)]
mat = og_mat.copy()
char = 'B'
new_line = True
to_be_replaced = []
for i in range(len(mat)):
	new_line = True
	for j in range(len(mat[i])):
		if mat[i][j] == '-':
			to_be_replaced.append((i, j))
		if new_line and i > 0:
			if mat[i - 1][j] == 'B':
				mat[i][j] = 'W'
			elif mat[i - 1][j] == 'W':
				mat[i][j] = 'B'
		if mat[i][j] == '.' or mat[i][j] == '-':
			mat[i][j] = char
			new_line = False
			if char == 'B':
				char = 'W'
			else:
				char = 'B'
for i in to_be_replaced:
	mat[i[0]][i[1]] = '-'
for i in range(len(mat)):
	for j in range(len(mat[i])):
		print(mat[i][j], end='')
	print('\n')


(n, m) = [int(x) for x in input().split()]
info = []
for i in range(n):
	x = [e for e in input()]
	info.append(x)
for i in range(n):
	if i % 2 == 0:
		for e in range(m):
			if info[i][e] == '.':
				if e % 2 == 0:
					info[i][e] = 'B'
				else:
					info[i][e] = 'W'
	else:
		for e in range(m):
			if info[i][e] == '.':
				if e % 2 == 0:
					info[i][e] = 'W'
				else:
					info[i][e] = 'B'
for i in info:
	print(''.join(i))


flag = input().split()
temp = []
for i in range(int(flag[0])):
	xx = list(input())
	temp.append(xx)
for x in range(int(flag[0])):
	for i in range(int(flag[1])):
		if temp[x][i] == '.' and (x + i) % 2 == 0:
			temp[x][i] = 'B'
		elif temp[x][i] == '.' and (x + i) % 2 != 0:
			temp[x][i] = 'W'
for i in range(int(flag[0])):
	for j in range(int(flag[1])):
		print(temp[i][j], end='')
	print()


(a, b) = map(int, input().split())
board = []
for i in range(a):
	board.append(input())
f = 'W'
for i in range(a):
	for j in range(b):
		if board[i][j] == '-':
			print(end='-')
		else:
			print(end=f)
		if f == 'W':
			f = 'B'
		else:
			f = 'W'
	if b % 2 == 0:
		if f == 'W':
			f = 'B'
		else:
			f = 'W'
	print()


(n, m) = map(int, input().split())
for i in range(n):
	s = list(input())
	for j in range(m):
		if s[j] == '.':
			if i + j & 1:
				s[j] = 'W'
			else:
				s[j] = 'B'
	print(''.join(s))


def opposite(colour):
	if colour == 'B':
		return 'W'
	else:
		return 'B'
sa = input().split(' ')
columns = int(sa[0])
rows = int(sa[1])
total = []
total2 = []
for x in range(columns):
	total.append(input())
length = len(total[0])
string = ''
for x in range(len(total)):
	string = ''
	for y in range(length):
		if total[x][y] == '.':
			if (x + y) % 2 == 1:
				string += 'B'
			else:
				string += 'W'
		else:
			string += '-'
	print(string)


mod = 10 ** 9 + 7
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, m) = f()
l = [[0] * m] * n
for _ in range(n):
	l[_] = ls()
for i in range(n):
	for j in range(m):
		if l[i][j] == '.':
			l[i][j] = 'BW'[(i + j) % 2]
for i in l:
	print(''.join(i))


(n, m) = map(int, input().split())
a = [list(input()) for i in range(n)]
ph = ['B', 'W']
for i in range(n):
	for j in range(m):
		if a[i][j] == '.':
			a[i][j] = ph[(i + j) % 2 == 0]
for i in range(n):
	for j in range(m):
		print(a[i][j], end='')
	print()


(x, y) = map(int, input().split())
li = [0] * x
for i in range(x):
	li[i] = list(input())
for i in range(x):
	for j in range(y):
		if li[i][j] == '.':
			if (i + j) % 2:
				li[i][j] = 'B'
			else:
				li[i][j] = 'W'
for i in range(x):
	print(''.join(li[i]))


(n, m) = list(map(int, input().split()))
field = [list(input()) for i in range(n)]
s1 = ''.join(('BW' for i in range(m // 2 + 1)))[:m]
s2 = ''.join(('WB' for i in range(m // 2 + 1)))[:m]
res = []
for i in range(n):
	res.append([])
	for j in range(m):
		if field[i][j] == '.':
			if i % 2 == 0:
				res[i].append(s1[j])
			else:
				res[i].append(s2[j])
		else:
			res[i].append('-')
for i in range(n):
	print(''.join(res[i]))


(n, m) = map(int, input().split())
list1 = []
list2 = []
for i in range(n):
	k = list(input())
	list1.append(k)
for i in range(n):
	list2.append([])
	for j in range(m):
		if j % 2 == 0 and i % 2 == 0 and (list1[i][j] != '-'):
			list2[i].append('B')
		elif j % 2 != 0 and i % 2 == 0 and (list1[i][j] != '-'):
			list2[i].append('W')
		elif j % 2 != 0 and i % 2 != 0 and (list1[i][j] != '-'):
			list2[i].append('B')
		elif j % 2 == 0 and i % 2 != 0 and (list1[i][j] != '-'):
			list2[i].append('W')
		else:
			list2[i].append('-')
for i in list2:
	k = ''.join(i)
	print(k)


(n, m) = map(int, input().split())
s = ''.join((input() for __ in range(n)))
if m % 2 == 0:
	a = list(('BW' * int(m / 2) + 'WB' * int(m / 2)) * int(n / 2) if n % 2 == 0 else ('BW' * int(m / 2) + 'WB' * int(m / 2)) * int(n / 2) + 'BW' * int(m / 2))
	for j in range(len(s)):
		if s[j] == '-':
			a[j] = '-'
	for k in range(0, len(a), m):
		print(*a[k:k + m], sep='')
else:
	a = list(('BW' * int(m / 2) + 'B' + 'WB' * int(m / 2) + 'W') * int(n / 2) if n % 2 == 0 else ('BW' * int(m / 2) + 'B' + 'WB' * int(m / 2) + 'W') * int(n / 2) + 'BW' * int(m / 2) + 'B')
	for j in range(len(s)):
		if s[j] == '-':
			a[j] = '-'
	for k in range(0, len(a), m):
		print(*a[k:k + m], sep='')


(n, m) = list(map(int, input().split()))
b = []
for i in range(n):
	a = input()
	c = ''
	if (i + 1) % 2 > 0:
		for g in range(m):
			if a[g] != '-':
				if (g + 1) % 2 > 0:
					c += 'W'
				else:
					c += 'B'
			else:
				c += '-'
	else:
		for g in range(m):
			if a[g] != '-':
				if (g + 1) % 2 > 0:
					c += 'B'
				else:
					c += 'W'
			else:
				c += '-'
	b.append(c)
for i in b:
	print(i)


dzy = []
(a, b) = map(int, input().split(' '))
for i in range(a):
	dzy.append([i for i in input()])
for i in range(a):
	for j in range(b):
		if dzy[i][j] == '.':
			if (i + j) % 2 == 0:
				dzy[i][j] = 'B'
			else:
				dzy[i][j] = 'W'
for i in dzy:
	print(''.join(i))


(R, C) = (int(i) for i in input().split(' '))
MAT = [[0 for _ in range(C)] for _ in range(R)]
rcnt = 0
for r in range(R):
	line = input()
	ccnt = 0
	for c in range(C):
		if line[c] == '-':
			MAT[r][c] = -1
		else:
			MAT[r][c] = (rcnt + ccnt) % 2 + 1
		ch = 'B' if MAT[r][c] == 1 else 'W' if MAT[r][c] == 2 else '-'
		print(ch, end='')
		ccnt += 1
	rcnt = (rcnt + 1) % 2
	print('')


from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)
(n, m) = mi()
l = []
f = 0
for i in range(n):
	x = []
	if i % 2 == 0:
		for j in range(m):
			if j % 2 == 0:
				x.append('B')
			else:
				x.append('W')
	else:
		for j in range(m):
			if j % 2 == 1:
				x.append('B')
			else:
				x.append('W')
	l.append(x)
out = []
for i in range(n):
	out.append(list(si()))
for i in range(n):
	for j in range(m):
		if out[i][j] == '-':
			l[i][j] = '-'
for i in range(n):
	print(''.join(l[i]))


(n, m) = map(int, input().split())
b = 'BW'
w = 'WB'
for _ in range(n):
	s = str(input())
	if _ % 2 == 0:
		s1 = list(b * m)
	else:
		s1 = list(w * m)
	s1 = s1[:m]
	for i in range(len(s)):
		if s[i] == '-':
			s1[i] = '-'
	for i in range(len(s1)):
		print(s1[i], end='')
	print('')


(n, m) = map(int, input().split())
a = []
for _ in range(n):
	a.append(list(input()))
for i in range(n):
	for j in range(m):
		if a[i][j] == '.':
			if i + j & 1:
				a[i][j] = 'W'
			else:
				a[i][j] = 'B'
for i in a:
	print(''.join(i))


(n, m) = map(int, input().split())
board = []
b = 'B'
w = 'W'
new_board = []
for i in range(n):
	board.append(input())
for i in range(n):
	new_board.append([])
	for j in range(m):
		if board[i][j] != '-':
			if i % 2 == 0:
				if j % 2 == 0:
					new_board[i].append(w)
				else:
					new_board[i].append(b)
			elif j % 2 == 0:
				new_board[i].append(b)
			else:
				new_board[i].append(w)
		else:
			new_board[i].append('-')
for i in range(n):
	for j in range(m):
		print(new_board[i][j], end='')
	print()


(n, m) = list(map(int, input().split()))
dp = [[0] * (m + 2)]
for _ in range(n):
	row = input()
	dp.append([0] + [int(b == '.') for b in row] + [0])
dp.append([0] * (m + 2))
di = [0, 0, -1, 1]
dj = [-1, 1, 0, 0]

def BFS(i, j):
	global dp, di, dj
	dp[i][j] = 2
	Q = [(i, j)]
	while Q:
		(i, j) = Q.pop()
		for k in range(4):
			if dp[i + di[k]][j + dj[k]] == 1:
				Q.append((i + di[k], j + dj[k]))
				dp[i + di[k]][j + dj[k]] = 5 - dp[i][j]
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if dp[i][j] == 1:
			BFS(i, j)
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if dp[i][j] == 0:
			print('-', end='')
		elif dp[i][j] == 2:
			print('B', end='')
		else:
			print('W', end='')
	print()


(n, m) = map(int, input().split())
a = []
s = ''
o = []
for i in range(n):
	s = input()
	a.append(s)
for i in range(n):
	p = ''
	for j in range(m):
		if a[i][j] == '-':
			p += '-'
		elif (i + j) % 2 == 0:
			p += 'W'
		else:
			p += 'B'
	o.append(p)
for i in o:
	print(i)


(n, m) = map(int, input().split())
for i in range(n):
	x = input()
	ans = ''
	for j in range(m):
		if j % 2 == 0:
			flag = 0
		else:
			flag = 1
		if not x[j] is '-':
			if i % 2 == 0:
				if flag:
					ans += 'W'
				else:
					ans += 'B'
			elif flag:
				ans += 'B'
			else:
				ans += 'W'
		else:
			ans += '-'
	print(ans)


s = input().split(' ')
m = int(s[0])
n = int(s[1])
res = ''
for i in range(m):
	str = input()
	for j in range(len(str)):
		if str[j] == '.':
			if (i + j) % 2 == 0:
				res += 'W'
			else:
				res += 'B'
		else:
			res += '-'
	res += '\n'
print(res)


def answer(n, m, a):
	ctr = 0
	for s in a:
		ans = []
		for c in s:
			if c == '.':
				if ctr % 2 == 0:
					ans.append('B')
				else:
					ans.append('W')
			else:
				ans.append('-')
			ctr += 1
		print(''.join(ans))
	return

def answer2(n, m, a):
	for r in range(n):
		ans = []
		for c in range(m):
			if (r + c) % 2 == 0 and a[r][c] == '.':
				ans.append('B')
			elif (r + c) % 2 == 1 and a[r][c] == '.':
				ans.append('W')
			else:
				ans.append('-')
		print(''.join(ans))

def main():
	(n, m) = [int(i) for i in input().split()]
	a = [0] * n
	for j in range(n):
		a[j] = input()
	answer2(n, m, a)
	return
main()


grid = []
dim = list(map(int, input().split()))
(n, m) = (dim[0], dim[1])
for _ in range(n):
	grid.append(list(str(input())))
ops = [['B', 'W'], ['W', 'B']]
grid_new = [[ops[i % 2][j % 2] for j in range(m)] for i in range(n)]
for i in range(n):
	for j in range(m):
		if grid[i][j] == '-':
			grid_new[i][j] = '-'
for i in range(n):
	print(''.join(grid_new[i]))


(a, b) = map(int, input().split())
l = ['W', 'B']
for i in range(a):
	m = list(input())
	for j in range(b):
		if m[j] == '.':
			m[j] = l[(i + j) % 2]
	print(''.join(m))


(n, m) = map(int, input().split())
a = []
for _ in range(n):
	x = input()
	a.append(x)
k = ['W', 'B']
for i in range(n):
	if i % 2 == 0:
		prev = 'W'
	else:
		prev = 'B'
	new_str = ''
	for j in range(m):
		if a[i][j] == '.':
			new_str += prev
		else:
			new_str += a[i][j]
		if prev == 'W':
			prev = 'B'
		else:
			prev = 'W'
	print(new_str)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
(n, m) = rints()
for y in range(n):
	print(''.join(('-' if c == '-' else 'B' if (x + y) % 2 == 0 else 'W' for (x, c) in enumerate(input()))))


test_mode = 0

def solver():
	(n, m) = map(int, input().split())
	d = []
	for i in range(n):
		d += [list(input())]
	for i in range(n):
		for j in range(m):
			if d[i][j] == '.':
				if (i + j) % 2 == 0:
					d[i][j] = 'B'
				else:
					d[i][j] = 'W'
		d[i] = ''.join(d[i])
	return '\n'.join(d)

def compare_answer(xx, xy):
	if xx == xy:
		print('Test passed\n\n')
	else:
		print('Failed! Expected   >> {}\n        Found      >> {}\n\n'.format(xy, xx))

def tprint(something):
	if test_mode:
		print(something)
if not test_mode:
	print(solver())
else:
	compare_answer(solver(), 'W')
	compare_answer(solver(), 1)
	compare_answer(solver(), 0)
	compare_answer(solver(), 28)


(n, m) = list(map(int, input().split()))
l = []
for _ in range(n):
	t = list(input())
	l.append(t)
for i in range(n):
	for j in range(m):
		if l[i][j] == '.':
			if (i + j) % 2 == 0:
				l[i][j] = 'B'
			else:
				l[i][j] = 'W'
		print(l[i][j], end='')
	print()


(n, m) = map(int, input().split())
mat = []
for _ in range(n):
	l = list(input())
	mat.append(l)
mat1 = [['B' if (i + j) % 2 == 0 else 'W' for i in range(m)] for j in range(n)]
for i in range(n):
	for j in range(m):
		if mat[i][j] == '-':
			mat1[i][j] = '-'
for i in range(n):
	print(*mat1[i], sep='')


(n, m) = list(map(int, input('').split()))
matrix = [[None if j == '.' else '-' for j in input('')] for i in range(n)]
for i in range(n):
	for j in range(m):
		set_col = {'W', 'B'}
		if matrix[i][j] != '-':
			if matrix[i][j] == None:
				flag = False
				if j + 1 < m:
					p = j + 1
					while p < m:
						if matrix[i][p] != None and matrix[i][p] != '-':
							if (p - j) % 2 == 0:
								matrix[i][j] = matrix[i][p]
								flag = True
								break
							else:
								matrix[i][j] = (set_col - set(matrix[i][p])).pop()
								flag = True
								break
						p += 1
				if not flag:
					matrix[i][j] = 'W'
			curr_col = matrix[i][j]
			opp_col = (set_col - set(curr_col)).pop()
			if i + 1 < n:
				if matrix[i + 1][j] == None:
					matrix[i + 1][j] = opp_col
			if j + 1 < m:
				if matrix[i][j + 1] == None:
					matrix[i][j + 1] = opp_col
				elif matrix[i][j + 1] == '-':
					k = j + 1
					while k < m:
						if matrix[i][k] == None:
							if (k - j) % 2 == 0:
								matrix[i][k] = curr_col
								break
							else:
								matrix[i][k] = opp_col
								break
						k += 1
for row in matrix:
	print(''.join(map(str, row)))


(n, m) = map(int, input().split())
l = []
for i in range(n):
	l.append(list(input()))
t = 'B'
for i in range(n):
	for j in range(m):
		if l[i][j] == '.':
			l[i][j] = t
		if j == m - 1 and j % 2 == 1:
			if t == 'W':
				t = 'B'
			else:
				t = 'W'
		if t == 'W':
			t = 'B'
		else:
			t = 'W'
for i in range(n):
	print(''.join(l[i]))


entrada = [int(x) for x in input().split()]
res = []
for i in range(entrada[0]):
	linha = input()
	linhaR = ''
	for j in range(entrada[1]):
		if linha[j] == '.':
			if (i + j) % 2 == 0:
				linhaR += 'B'
			else:
				linhaR += 'W'
		else:
			linhaR += '-'
	res.append(linhaR)
for i in res:
	print(i)


nm = list(map(int, input().strip().split()))
n = nm[0]
m = nm[1]
board = []
for i in range(n):
	row = list(input().strip())
	board.append(row)
color = ['B', 'W']
color_board = []
for i in range(n):
	row = []
	for j in range(m):
		if board[i][j] == '.':
			row.append(color[(i + j) % 2])
		else:
			row.append('-')
	color_board.append(row)
for i in range(n):
	print(''.join(color_board[i]))


from queue import *
mode = 'fiadasdle'
if mode == 'file':
	f = open('test.txt', 'r')
g = []
if mode == 'file':
	[n, m] = [int(x) for x in f.readline().split()]
	for i in range(n):
		g.append(f.readline()[:-1])
else:
	[n, m] = [int(x) for x in input().split()]
	for i in range(n):
		g.append(input())
count = 0
for i in range(n):
	g[i] = list(g[i])
	for j in g[i]:
		if j == '-':
			count += 1
while count < n * m:
	xyset = False
	for i in range(n):
		for j in range(m):
			if g[i][j] == '.':
				[x, y] = [i, j]
				xyset = True
				break
		if xyset:
			break
	q = Queue(0)
	q.put([[x, y], 'B'])
	while q.qsize() > 0:
		h = q.get()
		[x, y] = h[0]
		if g[x][y] != '.':
			continue
		mark = h[1]
		g[x][y] = mark
		if mark == 'W':
			mark = 'B'
		else:
			mark = 'W'
		for i in [[-1, 0], [0, -1], [1, 0], [0, 1]]:
			if x + i[0] < 0 or x + i[0] > n - 1 or y + i[1] < 0 or (y + i[1] > m - 1):
				continue
			if g[x + i[0]][y + i[1]] != '.':
				continue
			q.put([[x + i[0], y + i[1]], mark])
		count += 1
for i in range(n):
	for j in g[i]:
		print(j, end='')
	print()
if mode == 'file':
	f.close()


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def c(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def main():
	(n, m) = vars()
	ans = [['B' for j in range(m)] for i in range(n)]
	s = 1
	for i in range(n):
		start = s
		for j in range(s, m, 2):
			ans[i][j] = 'W'
		s ^= 1
	b = []
	for i in range(n):
		b.append(input())
	for i in range(n):
		for j in range(m):
			if b[i][j] == '-':
				ans[i][j] = '-'
	for r in ans:
		print(''.join(r))
t = 1
for _ in range(t):
	main()


from math import floor
from copy import deepcopy
whitefirst = False
(n, m) = [int(x) for x in input().split(' ')]
if m == 1:
	template = ['B']
	otemplate = ['W']
elif m % 2 == 0:
	template = ['B', 'W'] * int(m / 2)
	otemplate = ['W', 'B'] * int(m / 2)
else:
	template = ['B', 'W'] * floor(m / 2) + ['B']
	otemplate = ['W', 'B'] * floor(m / 2) + ['W']
for _ in range(n):
	row = input()
	if whitefirst:
		t = deepcopy(otemplate)
	else:
		t = deepcopy(template)
	for i in range(m):
		if row[i] == '-':
			t[i] = '-'
	print(''.join(t))
	whitefirst = not whitefirst


def change(x):
	if x == 'B':
		return 'W'
	else:
		return 'B'
(r, c) = map(int, input().split())
board = []
count = 0
arr = [input() for j in range(r)]
for i in range(r):
	temp = []
	if count % 2 == 0:
		x = 'B'
	else:
		x = 'W'
	for j in range(c):
		temp += [x]
		x = change(x)
	board += [temp]
	count += 1
for x in range(r):
	for y in range(c):
		if arr[x][y] == '-':
			board[x][y] = '-'
for x in board:
	for y in x:
		print(y, end='')
	print('')


from sys import stdin, stdout
(n, m) = map(int, stdin.readline().split())
s = []
for i in range(n):
	l = stdin.readline().split('\n')[0]
	s.append(list(l))
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
vis = set()

def bfs(s, si, sj, vis):
	q = [[si, sj, 'B']]
	while len(q):
		f = q.pop(0)
		(x, y, color) = (f[0], f[1], f[2])
		vis.add((x, y))
		s[x][y] = color
		for j in range(4):
			(nx, ny) = (x + dx[j], y + dy[j])
			if 0 <= nx < len(s) and 0 <= ny < len(s[0]) and ((nx, ny) not in vis) and (s[nx][ny] == '.'):
				if color == 'B':
					q.append([nx, ny, 'W'])
				else:
					q.append([nx, ny, 'B'])
				vis.add((nx, ny))
for i in range(n):
	for j in range(m):
		if s[i][j] == '.' and (i, j) not in vis:
			bfs(s, i, j, vis)
for i in range(n):
	stdout.write('{}\n'.format(''.join(s[i])))


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, m) = rinput()
s = []
for i in range(n):
	s.append(input())
for i in range(n):
	for j in range(m):
		if s[i][j] == '.':
			if (i + j) % 2 == 0:
				print('B', end='')
			else:
				print('W', end='')
		else:
			print('-', end='')
	print()


(n, m) = map(int, input().split())
a = [[0] * m for i in range(n)]
for i in range(n):
	tmp = input()
	for j in range(len(tmp)):
		a[i][j] = tmp[j]
r = 0
for i in range(len(a)):
	if i % 2 == 0:
		r = 0
	else:
		r = 1
	for j in range(len(a[i])):
		if a[i][j] == '.':
			if r == 0:
				a[i][j] = 'B'
			else:
				a[i][j] = 'W'
		r = 1 - r % 2
		print(a[i][j], end='')
	print()


(n, m) = map(int, input().split())
mat = []
for i in range(n):
	s = input()
	s = list(s)
	mat.append(s)
k = []
for i in range(n):
	ans = ''
	for j in range(m):
		if mat[i][j] != '-':
			if i % 2 == 0:
				if j % 2 == 0:
					ans += 'W'
				else:
					ans += 'B'
			elif j % 2 != 0:
				ans += 'W'
			else:
				ans += 'B'
		else:
			ans += '-'
	k.append(ans)
	ans = ''
for i in k:
	print(i)


board = []
new_board = []
hi = input().split()
n = int(hi[0])
m = int(hi[1])
for i in range(n):
	row = []
	rowl = input()
	newrow = []
	for j in range(m):
		row.append(rowl[j])
		newrow.append('')
	board.append(row)
	new_board.append(newrow)
for k in range(n):
	for j in range(m):
		if board[k][j] == '.':
			if (k + j) % 2 == 0:
				new_board[k][j] = 'W'
			else:
				new_board[k][j] = 'B'
		else:
			new_board[k][j] = '-'
for l in new_board:
	print(''.join(l))


(n, m) = [int(s) for s in input().split()]
arr = []
for _ in range(n):
	arr.append([c for c in input()])
j = 0
for str in arr:
	for i in range(j % 2, m, 2):
		if str[i] == '.':
			str[i] = 'B'
	j += 1
j = 1
for str in arr:
	for i in range(j % 2, m, 2):
		if str[i] == '.':
			str[i] = 'W'
	j += 1
for str in arr:
	res = ''.join((c for c in str))
	print(res)


class Node:

	def __init__(self, val, i, j):
		self.val = val
		self.i = i
		self.j = j
		self.visited = False
		self.neighbors = []
		self.prev = 'W'

	def addNeighbors(self, matrix):
		i = self.i
		j = self.j
		if i - 1 >= 0 and matrix[i - 1][j].val != '-':
			self.neighbors.append(matrix[i - 1][j])
		if j - 1 >= 0 and matrix[i][j - 1].val != '-':
			self.neighbors.append(matrix[i][j - 1])
		if i + 1 < rows and matrix[i + 1][j].val != '-':
			self.neighbors.append(matrix[i + 1][j])
		if j + 1 < cols and matrix[i][j + 1].val != '-':
			self.neighbors.append(matrix[i][j + 1])

def dfs(root):
	dic = {'W': 'B', 'B': 'W'}
	stack = []
	stack.append(root)
	while len(stack):
		curr = stack.pop(-1)
		if not curr.visited:
			curr.val = dic[curr.prev]
			curr.visited = True
		for neigh in curr.neighbors:
			if not neigh.visited:
				neigh.prev = curr.val
				stack.append(neigh)
(rows, cols) = map(int, input().split())
given = []
for i in range(rows):
	row = input()
	given.append(row)
matrix = []
for i in range(rows):
	row = []
	for j in range(cols):
		row.append(Node(given[i][j], i, j))
	matrix.append(row)
for i in range(rows):
	for j in range(cols):
		matrix[i][j].addNeighbors(matrix)
for i in range(rows):
	for j in range(cols):
		if not matrix[i][j].visited and matrix[i][j].val != '-':
			root = matrix[i][j]
			dfs(root)
for i in range(rows):
	for j in range(cols):
		print(matrix[i][j].val, end='')
	print()


(n, m) = map(int, input().split())
a = 'BW' * 50
b = 'WB' * 50
out = []
for i in range(50):
	out.append(list(a))
	out.append(list(b))
for i in range(n):
	ch = list(input())
	for j in range(m):
		if ch[j] == '-':
			out[i][j] = '-'
	print(*out[i][:m], sep='')


lis = list(map(int, input().split()))
n = lis[0]
m = lis[1]
matrix = []
for i in range(0, n):
	line = list(input())
	matrix.append(line)
for i in range(0, n):
	stri = ''
	for j in range(0, m):
		if matrix[i][j] == '.':
			if (i + j) % 2 == 0:
				matrix[i][j] = 'B'
			else:
				matrix[i][j] = 'W'
		stri = stri + matrix[i][j]
	print(stri)


(n, m) = map(int, input().split())
board = []
for i in range(1, n + 1):
	s = input()
	a = ''
	for j in range(m):
		if s[j] == '.':
			if (i + j + 1) % 2 == 0:
				a = a + 'W'
			else:
				a = a + 'B'
		else:
			a = a + s[j]
	board.append(a)
for i in board:
	print(i)


def solve(n, m, board):
	for i in range(n):
		for j in range(m):
			if board[i][j] == '.':
				if i + j & 1:
					board[i][j] = 'W'
				else:
					board[i][j] = 'B'
params = list(map(int, input().split()))
board = [list(input()) for _ in range(params[0])]
solve(params[0], params[1], board)
for i in range(params[0]):
	print(''.join(board[i]))


(n, m) = (int(x) for x in input().split())
for i in range(n):
	for (j, c) in enumerate(input()):
		if c == '.':
			print('B' if abs(i - j) % 2 == 0 else 'W', end='')
		else:
			print('-', end='')
	print()


(x, y) = input().split()
x = int(x)
y = int(y)
list1 = []
temp = []
i = 0
for i in range(0, x):
	temp = list(input())
	list1.append(temp)
i = 0
j = 0
for i in range(0, x):
	for j in range(0, y):
		if list1[i][j] == '.':
			if (i + 1) % 2 == 0:
				if (j + 1) % 2 == 0:
					list1[i][j] = 'B'
				else:
					list1[i][j] = 'W'
			elif (j + 1) % 2 == 0:
				list1[i][j] = 'W'
			else:
				list1[i][j] = 'B'
for i in range(0, x):
	for j in range(0, y):
		print(list1[i][j], end='')
	print()


(n, m) = [int(x) for x in input().split()]
for x in range(n):
	given = [x for x in input()]
	for i in range(m):
		if given[i] == '.':
			given[i] = 'B' if (x + i) % 2 else 'W'
	print(''.join(given))


(a, b) = map(int, input().split())
for i in range(a):
	string = input()
	for j in range(len(string)):
		if string[j] != '-':
			if i % 2 == 0 and j % 2 == 0:
				print('W', end='')
			if i % 2 == 0 and j % 2 != 0:
				print('B', end='')
			if i % 2 != 0 and j % 2 == 0:
				print('B', end='')
			if i % 2 != 0 and j % 2 != 0:
				print('W', end='')
		else:
			print('-', end='')
	print()


(n, m) = map(int, input().split())
path = []
c = ['B', 'W']
idex = 0
start = 0
for _ in range(n):
	path.append(list(input()))
for i in range(n):
	for j in range(m):
		color = []
		if path[i][j] == '.':
			path[i][j] = c[idex]
		idex ^= 1
	start ^= 1
	idex = start
for colors in path:
	print(''.join(colors))


import math
(n, m) = map(int, input().split())
a = 'WB' * math.ceil(m / 2)
b = 'BW' * math.ceil(m / 2)
c = list()
for i in range(n):
	c.append(input())
for i in range(n):
	for j in range(m):
		if i % 2 == 0:
			if c[i][j] == '.':
				print(a[j], end='')
			else:
				print('-', end='')
		elif c[i][j] == '.':
			print(b[j], end='')
		else:
			print('-', end='')
	print('\n', end='')


(n, m) = map(int, input().split())
b = []
for i in range(n):
	s = input()
	l = []
	for j in s:
		l.append(j)
	b.append(l)
for i in range(n):
	for j in range(m):
		if i % 2 == 0:
			if j % 2 == 0 and b[i][j] != '-':
				b[i][j] = 'B'
			elif b[i][j] != '-':
				b[i][j] = 'W'
		elif j % 2 == 0 and b[i][j] != '-':
			b[i][j] = 'W'
		elif b[i][j] != '-':
			b[i][j] = 'B'
for i in b:
	print(''.join(i))


(a, b) = input().split()
a = int(a)
for i in range(a):
	x = input()
	if i % 2 == 0:
		d = 0
	else:
		d = 1
	for j in range(len(x)):
		if x[j] == '.':
			if d % 2 == 0:
				print('B', end='')
				d = d + 1
			else:
				print('W', end='')
				d = d + 1
		elif x[j] == '-':
			print('-', end='')
			d = d + 1
	print()


(n, m) = map(int, input().split())
ans = []
temp = ''
for x in range(n):
	ans.append(list(input()))
for (index, x) in enumerate(ans):
	for (pos, z) in enumerate(x):
		if z == '.':
			if (pos + index) % 2 == 0:
				x[pos] = 'B'
			else:
				x[pos] = 'W'
for x in ans:
	print(*x, sep='')


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	arr.append(list(str(input().strip())))
for i in range(len(arr)):
	lastAssign = 'W' if i % 2 == 0 else 'B'
	for j in range(len(arr[0])):
		if arr[i][j] == '.':
			arr[i][j] = lastAssign
		lastAssign = 'B' if lastAssign == 'W' else 'W'
for y in arr:
	print(''.join((i for i in y)))


(n, m) = list(map(int, input().rstrip().split()))
mat = []
for i in range(n):
	l = input()
	mat += [list(l)]
for i in range(n):
	count = 0
	for j in range(m):
		if mat[i][j] == '.':
			if i + j & 1:
				mat[i][j] = 'W'
			else:
				mat[i][j] = 'B'
for i in range(n):
	for j in range(m):
		print(mat[i][j], end='')
	print()


(a, b) = map(int, input().split())
matriz = []
for i in range(a):
	matriz.append(input().replace('', ' ').split())
for i in range(a):
	for j in range(b):
		if (i + j) % 2 == 1 and matriz[i][j] == '.':
			matriz[i][j] = 'W'
		elif (i + j) % 2 == 0 and matriz[i][j] == '.':
			matriz[i][j] = 'B'
for i in range(a):
	for j in range(b):
		print(matriz[i][j], end='')
	print()


(n, m) = map(int, input().split())
for i in range(n):
	line = list(map(str, input()))
	for j in range(m):
		if line[j] == '.':
			line[j] = ['B', 'W'][(i + j) % 2]
	print(''.join(line))


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def inn():
	return int(input())
(n, m) = value()
a = [['-' for i in range(m)] for j in range(n)]
g = []
for i in range(n):
	s = input()
	g += [s]
for i in range(n):
	for j in range(m):
		if g[i][j] == '.':
			if (i + j) % 2 == 0:
				a[i][j] = 'W'
			else:
				a[i][j] = 'B'
for i in range(n):
	print(*a[i], sep='')


def gint():
	return int(input())

def gint_arr():
	return list(map(int, input().split()))

def gfloat():
	return float(input())

def gfloat_arr():
	return list(map(float, input().split()))

def pair_int():
	return map(int, input().split())
INF = 1 << 31
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
(n, m) = gint_arr()
board = [list(input()) for i in range(n)]
i = 0
chessman = {0: 'W', 1: 'B'}
while i < n:
	j = 0
	while j < m:
		color = chessman[(i + j) % 2]
		if board[i][j] == '.':
			board[i][j] = color
		j += 1
	i += 1
for row in board:
	print(''.join(row))


(n, m) = map(int, input().split())
M = [input() for i in range(n)]
for i in range(n):
	S = ''
	for j in range(m):
		if (i + 1) % 2 != 0 and (j + 1) % 2 != 0:
			if M[i][j] == '-':
				S = S + '-'
			else:
				S = S + 'B'
		if (i + 1) % 2 != 0 and (j + 1) % 2 == 0:
			if M[i][j] == '-':
				S = S + '-'
			else:
				S = S + 'W'
		if (i + 1) % 2 == 0 and (j + 1) % 2 != 0:
			if M[i][j] == '-':
				S = S + '-'
			else:
				S = S + 'W'
		if (i + 1) % 2 == 0 and (j + 1) % 2 == 0:
			if M[i][j] == '-':
				S = S + '-'
			else:
				S = S + 'B'
	print(S)


(n, m) = map(int, input().split())
for i in range(n):
	L = input()
	for j in range(m):
		if L[j] == '.':
			if (i + j) % 2 == 1:
				print('W', end='')
			else:
				print('B', end='')
		else:
			print('-', end='')
	print()


(n, m) = input().split()
(n, m) = (int(n), int(m))
lis = []
for i in range(n):
	lis.append(list(input()))
for i in range(n):
	for j in range(m):
		if lis[i][j] == '.':
			if (i - j) % 2 == 0:
				lis[i][j] = 'B'
			else:
				lis[i][j] = 'W'
for i in range(n):
	print(''.join(lis[i]))


def chess():
	(n, m) = map(int, input().split())
	liss = []
	for i in range(n):
		liss.append(list(map(str, input())))
	st = ''
	for i in range(n):
		for j in range(len(liss[0])):
			if liss[i][j] == '.':
				if abs(i - j) % 2 == 0:
					st += 'B'
				else:
					st += 'W'
			else:
				st = st + '-'
		print(st)
		st = ''
chess()


(n, m) = [int(x) for x in input().split(' ')]
matrix = []
for i in range(n):
	line = list(input())
	current_line = ''
	for j in range(m):
		if line[j] == '-':
			current_line += '-'
		elif (i + j) % 2 == 0:
			current_line += 'B'
		else:
			current_line += 'W'
	matrix.append(current_line)
print('\n'.join(matrix))


(n, m) = map(int, input().split())
(j, ans) = (0, 0)
for _ in range(n):
	s = input()
	ans += j
	for i in range(m):
		if s[i] == '.':
			if i + j & 1:
				print('B', end='')
			else:
				print('W', end='')
		else:
			print('-', end='')
		ans += 1
	j += 1
	print()


t = input().split()
(n, m) = (int(t[0]), int(t[1]))
l = 0
for i in range(n):
	s = input()
	p = 0
	for j in range(m):
		if s[j] is '.':
			(print('B' if (l + p) % 2 is 0 else 'W', end=''),)
		else:
			(print(s[j], end=''),)
		p += 1
	print()
	l += 1


(n, m) = map(int, input().split())
c = [0] * n
for i in range(n):
	x = list(input())
	c[i] = x
for i in range(n):
	for j in range(m):
		if c[i][j] == '.':
			if (i + j) % 2 == 0:
				c[i][j] = 'W'
			else:
				c[i][j] = 'B'
for i in range(n):
	print(*c[i], sep='')


grid = []

def main():
	global grid, n, m
	(n, m) = map(int, input().split(' '))
	for i in range(n):
		grid.append(list(input()))
	for i in range(n):
		cur = 'B' if i % 2 == 0 else 'W'
		for j in range(m):
			cur = 'W' if cur == 'B' else 'B'
			if grid[i][j] == '-':
				continue
			grid[i][j] = cur
main()
for i in range(n):
	print(''.join(grid[i]))


import sys
sys.setrecursionlimit(10000)
(n, m) = [int(x) for x in sys.stdin.readline().strip().split()]
arr = []
for i in range(0, n):
	arr.append(list(sys.stdin.readline().strip()))

def which(arr, i, j, n, m):
	index = [(1, 0), (0, 1), (-1, 0), (0, -1)]
	flag = True
	stack = []
	for (k, l) in index:
		a = i + k
		b = j + l
		if 0 <= a < n and 0 <= b < m and (arr[a][b] == 'B'):
			flag = False
		if 0 <= a < n and 0 <= b < m and (arr[a][b] == '.'):
			print
			stack.append((a, b))
	if not flag:
		return ('W', stack)
	return ('B', stack)
valid = {}
for i in range(n):
	for j in range(m):
		valid[i, j] = False
for (i, j) in valid.keys():
	if arr[i][j] == '.' and valid[i, j] == False:
		stack = [(i, j)]
		while stack:
			k = stack.pop()
			valid[k] = True
			(f, s) = which(arr, k[0], k[1], n, m)
			arr[k[0]][k[1]] = f
			stack = stack + s
for i in arr:
	print(''.join(i))


(n, m) = map(int, input().split())
ip = []
for i in range(n):
	s = input()
	ip.append(list(s))
board = [[0 for i in range(m)] for j in range(n)]
for i in range(n):
	for j in range(m):
		if i & 1 == 0:
			if j & 1 == 0:
				board[i][j] = 'B'
			else:
				board[i][j] = 'W'
		elif j & 1 == 0:
			board[i][j] = 'W'
		else:
			board[i][j] = 'B'
for i in range(n):
	for j in range(m):
		if ip[i][j] == '-':
			board[i][j] = '-'
for i in board:
	print(''.join((_ for _ in i)))


from collections import deque
(n, m) = map(int, input().split())
board = [list(input()) for _ in range(n)]
points = {(i, j) for i in range(n) for j in range(m) if board[i][j] == '.'}
while points:
	queue = deque([(*points.pop(), 'B')])
	while queue:
		(i, j, color) = queue.popleft()
		(board[i][j], color) = (color, 'BW'[color == 'B'])
		for (x, y) in ((i - 1, j), (i, j - 1), (i, j + 1), (i + 1, j)):
			if (x, y) in points:
				queue.append((x, y, color))
				points.remove((x, y))
for i in range(n):
	print(''.join(board[i]))


(n, m) = map(int, input().split())
matrix = []
for i in range(n):
	matrix.append(list(map(str, input())))
list1 = ['W', 'B']
flag = 0
toggle = 0
for i in range(n):
	for j in range(m):
		if matrix[i][j] == '.':
			matrix[i][j] = list1[flag]
		flag ^= 1
	toggle ^= 1
	flag = toggle
for row in matrix:
	print(''.join(row))


(r, c) = map(int, input().split())
ans = ''
bw = ['B', 'W']
flg = 0
for i in range(r):
	cb = input()
	if not cb:
		break
	for e in range(len(cb)):
		if cb[e] == '-':
			ans += '-'
		else:
			ans += bw[(i + e) % 2]
	print(ans)
	ans = ''
print(ans)


(n, m) = map(int, input().split())
for i in range(n):
	strin = input()
	ans = ''
	cc = 0
	for r in strin:
		if r == '-':
			ans += '-'
		elif i % 2 == 0:
			if cc % 2 == 0:
				ans += 'B'
			else:
				ans += 'W'
		elif i % 2 == 1:
			if cc % 2 == 1:
				ans += 'B'
			else:
				ans += 'W'
		cc += 1
	print(ans)


t = input().split()
(n, m) = (int(t[0]), int(t[1]))
C = 0
mass = []
for i in range(n):
	t = list(input())
	for j in range(len(t)):
		if t[j] == '.':
			if C == 0:
				C += 1
				t[j] = 'B'
			else:
				C -= 1
				t[j] = 'W'
		elif C == 0:
			C += 1
		else:
			C -= 1
	if m % 2 == 0:
		if C == 0:
			C += 1
		else:
			C -= 1
	mass.append(t)
for i in range(len(mass)):
	print(''.join(mass[i]))


import sys
f = sys.stdin
(n, m) = map(int, f.readline().strip().split())
res = []
for i in range(n):
	s = f.readline().strip()
	p = []
	for j in range(m):
		if s[j] == '.':
			if i % 2 == 0 and j % 2 == 0 or (i % 2 == 1 and j % 2 == 1):
				p.append('W')
			else:
				p.append('B')
		else:
			p.append('-')
	res.append(''.join(p))
print('\n'.join(res))


(n, m) = map(int, input().split())
mat = []
for i in range(n):
	mat.append(list(input()))
for i in range(len(mat)):
	for j in range(len(mat[i])):
		if mat[i][j] == '.':
			if (i + j) % 2 == 0:
				mat[i][j] = 'W'
			else:
				mat[i][j] = 'B'
for i in range(len(mat)):
	for j in range(len(mat[i])):
		print(mat[i][j], end='')
	print()


(n, m) = map(int, input().split())
p = [list(input()) for j in range(n)]
for i in range(0, n):
	for j in range(0, m):
		if p[i][j] == '.':
			if (i + j) % 2 == 0:
				p[i][j] = 'B'
			else:
				p[i][j] = 'W'
for i in range(0, n):
	print(''.join(p[i]))


(rows, cols) = [int(x) for x in input().split()]
string = [None] * rows
temp = []
for i in range(rows):
	temp = list(input())
	string[i] = temp
	temp = []
for i in range(rows):
	for j in range(cols):
		if (i + j) % 2 == 0:
			if string[i][j] == '.':
				string[i][j] = 'B'
		elif string[i][j] == '.':
			string[i][j] = 'W'
for i in range(rows):
	for j in range(cols):
		print(string[i][j], end='')
	print()


(n, m) = list(map(int, input().split()))
lst = []
board = []
for i in range(n):
	lst.append(input())
flag = True
for i in range(n):
	board.append([])
	if m % 2 == 0:
		flag = not flag
	for j in range(m):
		if flag:
			board[i].append('W')
			flag = False
		else:
			board[i].append('B')
			flag = True
for i in range(n):
	for j in range(m):
		if lst[i][j] == '-':
			board[i][j] = '-'
for i in range(n):
	for j in range(m):
		print(board[i][j], end='')
	print('')


(n, m) = map(int, input().split(' '))
for i in range(n):
	s = input()
	ans = ''
	for j in range(m):
		if s[j] == '-':
			ans += s[j]
		elif (i + j) % 2 == 1:
			ans += 'B'
		else:
			ans += 'W'
	print(ans)


a = [int(x) for x in input().split()]
n = a[0]
m = a[1]
f = [list(input()) for j in range(n)]
for i in range(n):
	for j in range(m):
		if f[i][j] == '.':
			if i % 2 ^ j % 2:
				f[i][j] = 'W'
			else:
				f[i][j] = 'B'
	print(''.join(f[i]))


(n, m) = map(int, input().split())
chessboard = []
for i in range(n):
	row = list(input())
	chessboard.append(row)
for i in range(n):
	for j in range(m):
		if chessboard[i][j] == '.':
			if (j + i) % 2 == 0:
				chessboard[i][j] = 'B'
			else:
				chessboard[i][j] = 'W'
for i in range(n):
	print(''.join([str(chessboard[i][j]) for j in range(m)]))


import random
(n, m) = map(int, input().split())
a = ['W', 'B']
for i in range(n):
	s = input()
	new_string = ''
	for j in range(m):
		if s[j] == '-':
			new_string += '-'
		elif s[j] == '.':
			new_string += a[(i + j) % 2]
	print(new_string)


(n, m) = map(int, input().split())
for i in range(n):
	(s, t) = (input(), '')
	for j in range(m):
		t += s[j] if s[j] == '-' else 'BW'[(i + j) % 2]
	print(t)


(a, b) = input().split()
rows = int(a)
columns = int(b)
ideal_board = []
new_row = ''
for i in range(0, rows):
	while len(new_row) < columns:
		if i % 2 == 0:
			if len(new_row) % 2 == 0:
				new_row = new_row + 'W'
			elif len(new_row) % 2 == 1:
				new_row = new_row + 'B'
		elif i % 2 == 1:
			if len(new_row) % 2 == 0:
				new_row = new_row + 'B'
			elif len(new_row) % 2 == 1:
				new_row = new_row + 'W'
	ideal_board.append(new_row)
	new_row = ''
judged_board = []
for i in range(0, rows):
	judged_board.append(input())
desired_board = []
for i in range(0, rows):
	examined_row = judged_board[i]
	total = examined_row.count('-')
	indices = []
	for j in range(0, total):
		location = examined_row.rindex('-')
		indices.append(location)
		examined_row = examined_row[0:location] + examined_row[location + 1:]
	desired_row = ''
	for k in range(0, len(ideal_board[i])):
		if k in indices:
			desired_row = desired_row + '-'
		else:
			desired_row = desired_row + ideal_board[i][k]
	desired_board.append(desired_row)
for row in desired_board:
	print(row)


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : map(int, stdin.readline().strip().split())
isa = lambda : stdin.readline().strip().split()
(n, m) = iia()
arr = []
for _ in range(n):
	arr.append(list(is1()))
tog = False
for i in range(n):
	tog1 = tog
	for j in range(m):
		if arr[i][j] == '.':
			if not tog1:
				arr[i][j] = 'B'
			else:
				arr[i][j] = 'W'
		tog1 = True if not tog1 else False
	tog = True if not tog else False
for i in arr:
	print(*i, sep='')


def solve():
	(n, m) = map(int, input().split())
	ans = []
	for _ in range(n):
		t = []
		for __ in range(m):
			t.append('')
		ans.append(t)
	for _ in range(n):
		s = input()
		___ = 0
		for __ in s:
			if __ == '.':
				ans[_][___] = 'B' if (_ + ___) % 2 == 0 else 'W'
			else:
				ans[_][___] = '-'
			___ += 1
	for _ in range(n):
		for __ in range(m):
			print(ans[_][__], end='')
		print()
solve()


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right
from collections import deque

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007
(n, m) = In()
ch = ['B', 'W']
flag = 0
for i in range(n):
	s = input()
	st = ''
	for j in range(m):
		if i % 2 == 0:
			flag = j % 2
		else:
			flag = (j + 1) % 2
		if s[j] == '.':
			st += ch[flag]
		else:
			st += s[j]
	print(st)


(n, m) = map(int, input().split())
chessboard = []
for i in range(n):
	chessboard.append(list(input()))
for i in range(n):
	for j in range(m):
		if chessboard[i][j] == '.':
			if i % 2 == j % 2:
				chessboard[i][j] = 'B'
			else:
				chessboard[i][j] = 'W'
for row in chessboard:
	for c in row:
		print(c, end='')
	print()


(n, m) = map(int, input().split(' '))
b = []
for i in range(n):
	tp = input()
	row = []
	for a in tp:
		row.append(a)
	b.append(row)
for i in range(n):
	for j in range(m):
		if b[i][j] == '-':
			continue
		if i % 2 == 0 and j % 2 == 0:
			b[i][j] = 'B'
		elif i % 2 == 1 and j % 2 == 0:
			b[i][j] = 'W'
		elif i % 2 == 0 and j % 2 == 1:
			b[i][j] = 'W'
		else:
			b[i][j] = 'B'
for i in range(n):
	for j in range(m):
		print(b[i][j], end='')
	print()


(r, c) = input().split()
r = int(r)
c = int(c)
l = []
l1 = []
a = 'B'
b = 'W'
for i in range(r):
	l1 = input()
	l.append(list(l1))
for i in range(r):
	for j in range(c):
		if l[i][j] == '.':
			print(a, end='')
		else:
			print('-', end='')
		temp = a
		a = b
		b = temp
	print('\n', end='')
	if c % 2 == 0:
		temp = a
		a = b
		b = temp


(n, m) = map(int, input().split())
lista = []
for j in range(n):
	str1 = input()
	lista.append(str1)
for i in range(len(lista)):
	string = lista[i]
	for j in range(len(string)):
		mystr = '-'
		if i % 2 == 0 and j % 2 == 0:
			mystr = 'B'
		if i % 2 == 0 and j % 2 != 0:
			mystr = 'W'
		if i % 2 != 0 and j % 2 == 0:
			mystr = 'W'
		if i % 2 != 0 and j % 2 != 0:
			mystr = 'B'
		if string[j] == '-':
			print('-', end='')
		else:
			print(mystr, end='')
	print()


(n, m) = map(int, input().split())
c = 0
ans = ''
for _ in range(n):
	s = list(input())
	c += 1
	if c % 2 == 1:
		for i in range(len(s)):
			if i % 2 == 1 and s[i] != '-':
				s[i] = 'B'
			elif i % 2 == 0 and s[i] != '-':
				s[i] = 'W'
	else:
		for i in range(len(s)):
			if i % 2 == 1 and s[i] != '-':
				s[i] = 'W'
			elif i % 2 == 0 and s[i] != '-':
				s[i] = 'B'
	ans += ''.join(s) + '\n'
print(ans)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	(n, m) = inlt()
	chars = ['W', 'B']
	final_string = ''
	for i in range(n):
		line = list(input())[0:-1]
		for j in range(m):
			if line[j] == '.':
				line[j] = chars[(i + j) % 2]
		final_string += ''.join(line) + '\n'
	print(final_string)
main()


(n, m) = map(int, input().split())
b = []
for i in range(n):
	b1 = list(input())
	b.append(b1)
for i in range(n):
	for j in range(m):
		if b[i][j] == '.':
			if (i + j) % 2 == 0:
				b[i][j] = 'B'
			else:
				b[i][j] = 'W'
for i in range(n):
	s1 = ''.join(b[i][:])
	print(s1)


(n, m) = map(int, input().split())
l = []
for i in range(n):
	k = list(input())
	l.append(k)
u = 'B'
for i in range(n):
	for j in range(m):
		if l[i][j] == '.':
			if i + j & 1:
				l[i][j] = 'W'
			else:
				l[i][j] = 'B'
for i in range(n):
	for j in range(m):
		print(l[i][j], end='')
	print()


def getinput():
	return [int(i) for i in input().split()]
(n, m) = getinput()
inl = {}
for i in range(n):
	line = input()
	for (j, char) in enumerate(line):
		inl[i, j] = char
import itertools
out = [('W', 'B'), ('B', 'W')]
for i in range(1, n + 1):
	chars = out[i % 2]
	for (j, char) in enumerate(itertools.cycle(chars)):
		if j == m:
			print()
			break
		if inl[i - 1, j] == '-':
			print('-', end='')
		else:
			print(char, end='')


import re
from collections import Counter
from sys import stderr
from typing import Union, Generator, List, Tuple
import string
INF = 2e+18 + 3
EPS = 1e-10

def main():
	(n, m) = map(int, input().split())
	answer_matrix = [['@'] * m for _ in range(n)]
	for (i, _) in enumerate(range(n)):
		for (j, sym) in enumerate(input()):
			if sym == '-':
				answer_matrix[i][j] = '-'
				continue
			if (i + j) % 2 == 0:
				answer_matrix[i][j] = 'W'
			else:
				answer_matrix[i][j] = 'B'
	print(*(''.join(row) for row in answer_matrix), sep='\n')
main()


(n, m) = map(int, input().split())
for i in range(n):
	temp = str(input())
	for j in range(len(temp)):
		if temp[j] == '.':
			if i % 2 == 0:
				if j % 2 == 0:
					print('B', end='')
				else:
					print('W', end='')
			elif j % 2 == 0:
				print('W', end='')
			else:
				print('B', end='')
		else:
			print('-', end='')
	print()


a = ['B', 'W']
(n, m) = map(int, input().split())
g = [input() for _ in range(n)]
for i in range(n):
	print(''.join([a[(i + j) % 2] if g[i][j] == '.' else '-' for j in range(m)]))


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
(n, m) = map(int, input().split())
w = 'WB'
b = 'BW'
for i in range(n):
	s = input()
	if i % 2 == 0:
		row = list(w * m)
	else:
		row = list(b * m)
	row = row[:m]
	for j in range(m):
		if s[j] == '-':
			row[j] = '-'
	print(''.join(row))


(n, m) = map(int, input().split())
board = []
ans = []
for i in range(n):
	s = input()
	board.append(list(s))
	tmp = []
	for j in range(m):
		if (i + j) % 2 == 0:
			tmp.append('B')
		else:
			tmp.append('W')
	ans.append(tmp)
for (index1, i) in enumerate(board):
	for (index2, j) in enumerate(i):
		if j != '-':
			print(ans[index1][index2], end='')
		else:
			print('-', end='')
	print()


(a, b) = input().split()
a = int(a)
b = int(b)
for i in range(a):
	str = input()
	ans = ''
	for j in range(b):
		if str[j] == '.':
			if i % 2 == 1:
				if j % 2 == 1:
					ans += 'B'
				else:
					ans += 'W'
			elif j % 2 == 1:
				ans += 'W'
			else:
				ans += 'B'
		else:
			ans += '-'
	print(ans)


(n, m) = map(int, input().split())
f = []
for i in range(n):
	f.append(list(str(input())))
for i in range(n):
	for j in range(m):
		if f[i][j] == '.':
			if (i + j) % 2 == 0:
				f[i][j] = 'B'
			else:
				f[i][j] = 'W'
		print(f[i][j], end='')
	print()


(n, m) = map(int, input().split())
cb = []
for i in range(n):
	cb.append(input())
res = []
col = 'B'
for i in range(n):
	r = ''
	for j in range(m):
		if cb[i][j] == '-':
			r = r + '-'
		else:
			r = r + col
		if j != m - 1 or m % 2 != 0:
			if col == 'B':
				col = 'W'
			else:
				col = 'B'
	res.append(r)
for i in res:
	print(i)


(n, m) = map(int, input().split())
b = [list(input()) for i in range(n)]
a = [[] for _ in range(n)]
for i in range(n):
	for j in range(m):
		if b[i][j] == '.':
			if (i + j) % 2 == 0:
				a[i].append('W')
			else:
				a[i].append('B')
		else:
			a[i].append('-')
for e in a:
	print(''.join(e))


def main():
	(n, m) = [int(i) for i in input().split()]
	table = [input() for i in range(n)]
	for i in range(n):
		for j in range(m):
			if table[i][j] == '-':
				print('-', end='')
			elif (i + j) % 2 == 0:
				print('B', end='')
			else:
				print('W', end='')
		print()
main()


(n, m) = map(int, input().split())
string = []
for _ in range(n):
	row = input()
	string.append(row)
result = []
for i in range(n):
	ans = ''
	for j in range(m):
		if string[i][j] != '-' and (i + j) % 2 == 0:
			ans += 'B'
		elif string[i][j] != '-' and (i + j) % 2 != 0:
			ans += 'W'
		else:
			ans += '-'
	result.append(ans)
for i in range(n):
	print(''.join(result[i]))


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
b = ['B', 'W']
k = 0
for j in range(n):
	k = j % 2
	for i in a[j]:
		if i == '.':
			print(b[k], end='')
		else:
			print('-', end='')
		k = k ^ 1
	print()


(n, m) = list(map(int, input().split()))
arr100 = []
for _ in range(n):
	arr100.append([])
	arr = list(map(str, list(input())))
	for k in range(m):
		if arr[k] == '-':
			arr100[_].append('-')
		elif _ % 2 == 0:
			if k % 2 == 0:
				arr100[_].append('B')
			else:
				arr100[_].append('W')
		elif k % 2 == 0:
			arr100[_].append('W')
		else:
			arr100[_].append('B')
	print(''.join(arr100[_]))


def str_to_list(a):
	y = []
	for i in range(len(a)):
		y.append(a[i])
	return y

def list_to_str(a):
	y = ''
	for i in range(len(a)):
		y = y + str(a[i])
	return y
(n, m) = map(int, input().split())
b = []
for i in range(n):
	a = input()
	a = str_to_list(a)
	b.append(a)
for i in range(n):
	for j in range(m):
		if i % 2 == 0:
			if j % 2 == 0 and b[i][j] == '.':
				b[i][j] = 'W'
			elif j % 2 != 0 and b[i][j] == '.':
				b[i][j] = 'B'
		elif j % 2 == 0 and b[i][j] == '.':
			b[i][j] = 'B'
		elif j % 2 != 0 and b[i][j] == '.':
			b[i][j] = 'W'
for i in b:
	print(list_to_str(i))


(N, M) = map(int, input().split())
l = [[i for i in input()] for j in range(N)]
used = [[False for i in range(M)] for j in range(N)]
for i in range(N):
	for j in range(M):
		if l[i][j] == '.':
			if (i + j) % 2 == 0:
				l[i][j] = 'B'
			else:
				l[i][j] = 'W'
for i in range(N):
	print(''.join(l[i]))


(n, m) = map(int, input().split())
b = []
for _ in range(n):
	b.append(list(input()))
for i in range(n):
	for j in range(m):
		if b[i][j] == '.':
			if i % 2 == 0 and j % 2 == 0:
				b[i][j] = 'W'
			elif i % 2 == 1 and j % 2 == 0:
				b[i][j] = 'B'
			elif i % 2 == 1 and j % 2 == 1:
				b[i][j] = 'W'
			else:
				b[i][j] = 'B'
for i in range(n):
	print(''.join(b[i]))


def get_input():
	(n, m) = map(int, input().strip().split())
	board = []
	for i in range(n):
		board.append(input().strip())
	return board

def fill_up(board):
	new_board = []
	for (row_idx, row) in enumerate(board):
		new_row = ''
		for (col_idx, ch) in enumerate(row):
			if ch == '-':
				new_row += ch
			else:
				new_row += 'B' if (row_idx + col_idx) % 2 else 'W'
		new_board.append(new_row)
	return new_board
board = get_input()
filled_board = fill_up(board)
for row in filled_board:
	print(row)


a = []
point = []
visited = set()
dx = (0, 0, -1, 1)
dy = (-1, 1, 0, 0)

def bfs(x, y):
	a[x][y] = 'B'
	q = []
	q.append((x, y))
	visited.add((x, y))
	while len(q) > 0:
		p = (q[-1][0], q[-1][1])
		q.pop()
		for i in range(len(dx)):
			tox = p[0] + dx[i]
			toy = p[1] + dy[i]
			if a[tox][toy] == '.' and (tox, toy) not in visited:
				visited.add((tox, toy))
				q.append((tox, toy))
			if a[tox][toy] == 'B':
				a[p[0]][p[1]] = 'W'
			elif a[tox][toy] == 'W':
				a[p[0]][p[1]] = 'B'
(n, m) = [int(x) for x in input().split()]
for i in range(n + 2):
	a.append([])
	for j in range(m + 2):
		a[-1].append('#')
i = 1
while i <= n:
	s = [x for x in input()]
	j = 1
	while j <= m:
		a[i][j] = s[j - 1]
		if a[i][j] == '.':
			point.append((i, j))
		j += 1
	i += 1
for po in point:
	if (po[0], po[1]) not in visited:
		bfs(po[0], po[1])
i = 1
while i <= n:
	j = 1
	while j <= m:
		print(a[i][j], end='')
		j += 1
	print()
	i += 1


[rows, cols] = [int(x) for x in input().split()]
chess = []
for i in range(rows):
	temp = list(input())
	chess.append(temp)
	temp = []
for i in range(len(chess)):
	for j in range(len(chess[i])):
		if chess[i][j] == '-':
			continue
		if (i + j) % 2 == 0:
			chess[i][j] = 'B'
		else:
			chess[i][j] = 'W'
for i in range(rows):
	for j in range(cols):
		print(chess[i][j], end='')
	print()


(n, m) = list(map(int, input().split()))
mat = []
for i in range(n):
	mat.append(list(map(str, input())))
for i in range(n):
	for j in range(m):
		if mat[i][j] == '.':
			if i % 2 == 0 and j % 2 == 0 or (i % 2 != 0 and j % 2 != 0):
				mat[i][j] = 'B'
			else:
				mat[i][j] = 'W'
for i in mat:
	print(''.join((str(x) for x in i)))


(n, m) = [int(x) for x in input().split()]
a = []
for i in range(0, n):
	a.append(input())
f = 1
for i in range(0, n):
	for j in range(0, m):
		if a[i][j] == '-':
			print(a[i][j], end='')
		if a[i][j] == '.':
			if f == 1:
				print('B', end='')
			else:
				print('W', end='')
		f ^= 1
	if m % 2 == 0:
		f ^= 1
	print('')


import os
import sys
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')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def abs(x):
	return x if x >= 0 else -x

def sumelem(x, start, end):
	sum = 0
	for i in range(start, end + 1):
		sum += x[i]
	return sum
for t in range(1):
	(n, m) = list(map(int, input().split()))
	li = []
	for i in range(n):
		string = input()
		li.append([])
		for j in range(m):
			li[-1].append(string[j])
	for i in range(n):
		for j in range(m):
			if li[i][j] == '.':
				if i % 2 == 0:
					if j % 2 == 0:
						li[i][j] = 'B'
					else:
						li[i][j] = 'W'
				elif j % 2 == 1:
					li[i][j] = 'B'
				else:
					li[i][j] = 'W'
	for i in range(n):
		for j in range(m):
			print(li[i][j], end='')
		print('')


(n, m) = map(int, input().split())
graph = [list(input()) for _ in range(n)]

def bfs(start):
	global graph

	def is_valid(i, j):
		return 0 <= i < n and 0 <= j < m
	(layer, flag) = ([start], False)
	while layer:
		next_layer = []
		for (i, j) in layer:
			for (x, y) in ((0, -1), (0, 1), (1, 0), (-1, 0)):
				if is_valid(i + x, j + y) and graph[i + x][j + y] == '.':
					graph[i + x][j + y] = 'B' if flag else 'W'
					next_layer.append((i + x, j + y))
		(layer, flag) = (next_layer, not flag)
for i in range(n):
	for j in range(m):
		if graph[i][j] == '.':
			graph[i][j] = 'B'
			bfs((i, j))
print('\n'.join((''.join(row) for row in graph)))


(n, m) = [int(x) for x in input().split()]
grid = []
for i in range(n):
	grid.append([c for c in input()])
st = 'B'
newgrid = []
for i in range(n):
	g = [st for j in range(m)]
	if st == 'B':
		st = 'W'
	else:
		st = 'B'
	for j in range(0, m, 2):
		g[j] = st
	newgrid.append(g)
for i in range(n):
	for j in range(m):
		if grid[i][j] == '-':
			newgrid[i][j] = '-'
		print(newgrid[i][j], end='')
	print()


nm = input().split(' ')
(n, m) = [int(x) for x in nm]
chessboard = []
for i in range(n):
	line = list(input())
	chessboard.append(line)
avalaibles = []
validB = ['.', 'W', '-']
validW = ['.', 'B', '-']
queue = []
for k in range(n):
	for l in range(m):
		if chessboard[k][l] == '.':
			chessboard[k][l] = 'B'
			queue.insert(0, (k, l))
			while not queue == []:
				(i, j) = queue.pop()
				if chessboard[i][j] == 'B':
					if i - 1 < 0:
						pass
					elif chessboard[i - 1][j] == '.':
						chessboard[i - 1][j] = 'W'
						queue.insert(0, (i - 1, j))
					if i + 1 == n:
						pass
					elif chessboard[i + 1][j] == '.':
						chessboard[i + 1][j] = 'W'
						queue.insert(0, (i + 1, j))
					if j - 1 < 0:
						pass
					elif chessboard[i][j - 1] == '.':
						chessboard[i][j - 1] = 'W'
						queue.insert(0, (i, j - 1))
					if j + 1 == m:
						pass
					elif chessboard[i][j + 1] == '.':
						chessboard[i][j + 1] = 'W'
						queue.insert(0, (i, j + 1))
				elif chessboard[i][j] == 'W':
					if i - 1 < 0:
						pass
					elif chessboard[i - 1][j] == '.':
						chessboard[i - 1][j] = 'B'
						queue.insert(0, (i - 1, j))
					if i + 1 == n:
						pass
					elif chessboard[i + 1][j] == '.':
						chessboard[i + 1][j] = 'B'
						queue.insert(0, (i + 1, j))
					if j - 1 < 0:
						pass
					elif chessboard[i][j - 1] == '.':
						chessboard[i][j - 1] = 'B'
						queue.insert(0, (i, j - 1))
					if j + 1 == m:
						pass
					elif chessboard[i][j + 1] == '.':
						chessboard[i][j + 1] = 'B'
						queue.insert(0, (i, j + 1))
for i in range(n):
	row = ''
	for j in range(m):
		row += chessboard[i][j]
	print(row)


z = []
a = list(map(int, input().split()))
for i in range(a[0]):
	m = input()
	z += [list(m)]
for i in range(a[0]):
	for j in range(a[1]):
		if z[i][j] == '.':
			if (i + j) % 2 == 0:
				print('B', end='')
			else:
				print('W', end='')
		else:
			print('-', end='')
	print('\n')


s = input()
k = s.split()
n = int(k[0])
m = int(k[1])
for i in range(n):
	v = input()
	v.split()
	t = ''
	if i % 2 == 0:
		for j in range(m):
			if v[j] == '-':
				t += '-'
			elif j % 2 == 0:
				t += 'B'
			elif j % 2 == 1:
				t += 'W'
		print(t)
	else:
		for j in range(m):
			if v[j] == '-':
				t += '-'
			elif j % 2 == 0:
				t += 'W'
			elif j % 2 == 1:
				t += 'B'
		print(t)


[n, m] = list(map(int, input().split(' ')))
c = ['B', 'W']
for i in range(n):
	s = list(input())
	for j in range(m):
		if s[j] == '.':
			s[j] = c[(i + j) % 2]
	print(*s, sep='')


ww = input()
nrow = int(ww.split(' ')[0])
ncol = int(ww.split(' ')[1])
li = []
for i in range(nrow):
	www = input()
	for j in range(ncol):
		if www[j] == '.':
			li.append(1)
		else:
			li.append(0)
co = []
for i in range(nrow):
	for j in range(ncol):
		if (i + j) % 2 == 0:
			co.append('W')
		else:
			co.append('B')
for i in range(nrow):
	for j in range(ncol):
		if li[i * ncol + j] == 1:
			print(co[i * ncol + j], end='')
		else:
			print('-', end='')
	print('')


def main():
	(n, m) = map(int, input().split())
	l = [input() for _ in range(n)]
	ll = [s + '-' for s in l]
	ll.append('-' * (m + 1))
	neigh = []
	for y in range(n):
		for x in range(m):
			nn = []
			if l[y][x] == '.':
				for (y1, x1) in ((y - 1, x), (y + 1, x), (y, x - 1), (y, x + 1)):
					if ll[y1][x1] == '.':
						nn.append(y1 * m + x1)
			neigh.append(tuple(nn) if nn else ())
	l = list(''.join(l))
	nxt = False
	while '.' in l:
		if not nxt:
			nxt = {l.index('.')}
			black = True
		(cur, nxt) = (nxt, set())
		for idx in cur:
			l[idx] = 'WB'[black]
			for i in neigh[idx]:
				if l[i] == '.':
					nxt.add(i)
		black ^= True
	for i in range(0, n * m, m):
		print(''.join(l[i:i + m]))
main()


import sys
from collections import deque
dirs = ((-1, 0), (1, 0), (0, -1), (0, 1))

def fill(r, co):
	tablero[r][co] = 'B'
	q = deque()
	q.append((r, co))
	while q:
		(r, co) = q.popleft()
		for u in dirs:
			(rr, cc) = (r + u[0], co + u[1])
			if 0 <= rr < fila and 0 <= cc < columna and (tablero[rr][cc] == '.'):
				tablero[rr][cc] = 'W' if tablero[r][co] == 'B' else 'B'
				q.append((rr, cc))

def juego():
	global fila, columna, tablero
	tablero = []
	inputs = [linea for linea in sys.stdin]
	matriz = list(map(int, inputs[0].split(' ')))
	fila = matriz[0]
	columna = matriz[1]
	for i in range(len(inputs)):
		if i >= 1:
			tablero.append(list(inputs[i].strip()))
	for r in range(fila):
		for co in range(columna):
			if tablero[r][co] == '.':
				fill(r, co)
			print(tablero[r][co], end='')
		print('')
juego()


(n, m) = [int(x) for x in input().split()]
l = []
for i in range(n):
	s = input()
	l.append(list(s))
res = []
for i in range(n):
	temp = []
	for j in range(m):
		if l[i][j] == '-':
			temp.append('-')
		elif (i + j) % 2 != 0:
			temp.append('W')
		else:
			temp.append('B')
	res.append(temp)
for x in res:
	for y in x:
		print(y, end='')
	print()


(n, m) = map(int, input().split())
board = list()
for i in range(n):
	board.append(input())
for (i, a) in enumerate(board):
	for (j, b) in enumerate(a):
		if b == '.':
			if (i + j) % 2 == 1:
				print('B', end='')
			else:
				print('W', end='')
		else:
			print('-', end='')
	print()


(n, m) = map(int, input().split())
board = []
for i in range(n):
	if i % 2 == 0:
		start = 'B'
	else:
		start = 'W'
	aa = []
	for j in range(m):
		aa += [start]
		if start == 'B':
			start = 'W'
		else:
			start = 'B'
	board.append(aa)
board1 = []
for i in range(n):
	d = input().split()
	board1 += d
for i in range(n):
	for j in range(m):
		if board1[i][j] == '-':
			print('-', sep='', end='')
		else:
			print(board[i][j], sep='', end='')
	print()


(n, m) = map(int, input().split())
(t, p) = ([list(input()) for i in range(n)], 'BW')
for i in range(n):
	for j in range(m):
		if t[i][j] == '.':
			t[i][j] = p[i + j & 1]
	t[i] = ''.join(t[i])
print('\n'.join(t))


from collections import deque

def main():
	(num_rows, num_cols) = map(int, input().split())
	board = []
	for i in range(num_rows):
		row = list(input())
		board.append(row)
	for i in range(num_rows):
		for j in range(num_cols):
			if board[i][j] == '.':
				place_chessmen(board, num_rows, num_cols, i, j)
	for row in board:
		print(''.join(row))

def place_chessmen(board, num_rows, num_cols, y, x):
	q = deque()
	q.appendleft((y, x, True))
	while q:
		(y, x, is_black) = q.pop()
		if 0 <= y < num_rows and 0 <= x < num_cols and (board[y][x] == '.'):
			board[y][x] = 'B' if is_black else 'W'
			q.append((y + 1, x, not is_black))
			q.append((y - 1, x, not is_black))
			q.append((y, x + 1, not is_black))
			q.append((y, x - 1, not is_black))
main()


(n, m) = map(int, input().split())
a = ['W', 'B']
for i in range(n):
	s = list(input())
	for j in range(m):
		if s[j] == '.':
			s[j] = a[(i + j) % 2]
	print(''.join(s))


(n, m) = map(int, input().split())
mat = []
for i in range(n):
	mat.append(input())
res = []
for i in range(100):
	res.append(list('WBWBWB' * 18))
	res.append(list('BWBWBW' * 18))
for i in range(n):
	for j in range(m):
		if mat[i][j] == '-':
			res[i][j] = '-'
		print(res[i][j], end='')
	print()


from sys import stdin
from collections import deque
dirs = ((-1, 0), (1, 0), (0, -1), (0, 1))

def fill(r, c):
	board[r][c] = 'B'
	q = deque()
	q.append((r, c))
	while q:
		(r, c) = q.popleft()
		for u in dirs:
			(rr, cc) = (r + u[0], c + u[1])
			if 0 <= rr < n and 0 <= cc < m and (board[rr][cc] == '.'):
				board[rr][cc] = 'W' if board[r][c] == 'B' else 'B'
				q.append((rr, cc))

def main():
	global n, m, board
	line = stdin.readline()
	(n, m) = map(int, line.strip().split(' '))
	board = [[None for _ in range(m)] for _ in range(n)]
	for r in range(n):
		line = stdin.readline()
		for c in range(m):
			board[r][c] = line[c]
	for r in range(n):
		for c in range(m):
			if board[r][c] == '.':
				fill(r, c)
			print(board[r][c], end='')
		print('')
main()


(n, m) = map(int, input().split())
a = []
oe = 1
ans = ''
for i in range(n):
	a.append(list(input()))
for i in range(n):
	row = ''
	for j in range(m):
		if a[i][j] == '-':
			row += '-'
		elif oe % 2:
			row += 'B'
		else:
			row += 'W'
		oe += 1
	ans += row + '\n'
	oe = 1 if i % 2 else 0
print(ans)


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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:
			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')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

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

def getStrs():
	return input().split()

def isInt(s):
	return '0' <= s[0] <= '9'

def input():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in input().split()]

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
num = 1
for i in range(num):
	(m, n) = zzz()
	for i in range(m):
		s = getStr()
		print(''.join(('-BW'[((i + j) % 2 + 1) * (s[j] != '-')] for j in range(n))))


(n, m) = map(int, input().split())
board = []
for i in range(n):
	board.append(list(input()))
pieces = ['B', 'W']
for i in range(n):
	for j in range(m):
		if board[i][j] == '.':
			board[i][j] = pieces[(i + j) % 2]
		print(board[i][j], end='')
	print()


(n, m) = map(int, input().split())
t = []
for i in range(n):
	s = input()
	s = list(s)
	t.append(s)
for i in range(n):
	for j in range(m):
		if (i + j) % 2 == 0 and t[i][j] == '.':
			t[i][j] = 'W'
		elif (i + j) % 2 != 0 and t[i][j] == '.':
			t[i][j] = 'B'
		else:
			t[i][j] = '-'
for i in range(n):
	for j in range(m):
		print(t[i][j], end='')
	print()


I = lambda : map(int, input().split())
(a, b) = I()
li = [0] * a
for i in range(a):
	li[i] = list(input())
for i in range(a):
	for j in range(b):
		if li[i][j] == '.':
			li[i][j] = 'W' if (i + j) % 2 else 'B'
for i in range(a):
	print(''.join(li[i]))


a = input().split()
(n, m) = (int(a[0]), int(a[1]))
chessboard = []
for time in range(n):
	row = input()
	chessboard.append(row)
new_chessboard = []
flag = True
for x in range(n):
	row = ''
	for y in range(m):
		if chessboard[x][y] == '-':
			row += '-'
		elif flag:
			if y % 2 == 0:
				row += 'B'
			else:
				row += 'W'
		elif y % 2 == 0:
			row += 'W'
		else:
			row += 'B'
	if flag:
		flag = False
	else:
		flag = True
	print(row)


(n, m) = map(int, input().split())
s = ['B', 'W']
for i in range(n):
	for (k, j) in enumerate(input()):
		if j == '.':
			if i % 2 == 0:
				print(s[k % 2], end='')
			else:
				print(s[(k + 1) % 2], end='')
		else:
			print('-', end='')
	print('')


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)
import os
import sys
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 collections import Counter
(n, m) = map(int, input().split())
f = 1
for i in range(n):
	s = list(input())
	for j in range(m):
		if s[j] == '.':
			if (i + j) % 2 == 0:
				s[j] = 'B'
			else:
				s[j] = 'W'
	print(''.join(s))


(n, m) = list(map(int, input().split()))
if n == 1:
	s = input()
	l = []
	for i in range(m):
		if i % 2 == 0:
			if s[i] == '.':
				l.append('B')
			else:
				l.append('-')
		elif s[i] == '.':
			l.append('W')
		else:
			l.append('-')
	print(''.join(l))
elif m == 1:
	for i in range(n):
		s = input()
		if i % 2 == 0:
			if s == '.':
				print('B')
			else:
				print('-')
		elif s == '.':
			print('W')
		else:
			print('-')
else:
	for i in range(n):
		s = input()
		if i % 2 == 0:
			x = 'BW' * (m - 1)
			l = []
			for i in range(len(s)):
				if s[i] == '.':
					l.append(x[i])
				else:
					l.append(s[i])
			print(''.join(l))
		else:
			x = 'WB' * (m - 1)
			l = []
			for i in range(len(s)):
				if s[i] == '.':
					l.append(x[i])
				else:
					l.append(s[i])
			print(''.join(l))


R1 = lambda : list(map(int, input().split()))
R2 = lambda : int(input())
(n, m) = R1()
res = ''
for i in range(n):
	s = input()
	r = ''
	l = 'B' if i % 2 == 0 else 'W'
	for j in range(m):
		if s[j] == '.':
			r += l
		else:
			r += '-'
		l = 'B' if l == 'W' else 'W'
	res += r + '\n'
print(res)


(n, m) = list(map(int, input().split()))
board = []
out = []
for _ in range(n):
	board.append(input())
for i in range(n):
	row = ''
	for j in range(m):
		if board[i][j] != '.':
			row += '-'
			continue
		if (j + i) % 2:
			row += 'W'
		else:
			row += 'B'
	out.append(row)
for r in out:
	print(r)


(n, m) = map(int, input().split())
x = 0
for i in range(n):
	s = input()
	st = ''
	for c in s:
		st += '-' if c == '-' else 'BW'[x % 2]
		x += 1
	x += 1 - m % 2
	print(st)


(n, m) = map(int, input().split())
l = []
for i in range(n):
	s = input()
	t = ''
	for j in range(m):
		if i % 2 == 0:
			if s[j] == '-':
				t += '-'
			elif j % 2 == 0:
				t += 'B'
			else:
				t += 'W'
		elif i % 2 != 0:
			if s[j] == '-':
				t += '-'
			elif j % 2 != 0:
				t += 'B'
			else:
				t += 'W'
	print(t)


(n, m) = map(int, input().split())
board = [list(input()) for i in range(n)]
color = ['W', 'B']
for i in range(n):
	for j in range(m):
		if board[i][j] == '.':
			board[i][j] = color[(i + j) % 2]
for row in board:
	print(''.join(row))


(n, m) = [int(x) for x in input().split()]
p = []
for i in range(n):
	l = input()
	string = ''
	for j in range(m):
		if i % 2 == 0:
			if j % 2 == 0 and l[j] == '.':
				string += 'B'
			elif j % 2 != 0 and l[j] == '.':
				string += 'W'
			else:
				string += '-'
		elif j % 2 == 0 and l[j] == '.':
			string += 'W'
		elif j % 2 != 0 and l[j] == '.':
			string += 'B'
		else:
			string += '-'
	p.append(string)
for i in p:
	print(i)


(n, m) = map(int, input().split())
result = []
for i in range(n):
	f = i % 2
	s = ''
	for el in input():
		s += el if el == '-' else 'WB'[f]
		f = not f
	result.append(s)
print('\n'.join(result))


(r, c) = map(int, input().split())
ans = ''
turn = 'b'
for i in range(1, r + 1):
	b = input()
	if b == '':
		break
	for e in range(len(b)):
		if b[e] == '.':
			if turn == 'b':
				ans += 'B'
				turn = 'w'
				continue
			elif turn == 'w':
				ans += 'W'
				turn = 'b'
				continue
		elif b[e] == '-':
			ans += '-'
			if turn == 'b':
				turn = 'w'
				continue
			elif turn == 'w':
				turn = 'b'
				continue
	ans += '\n'
	if c % 2 == 0:
		if turn == 'b':
			turn = 'w'
		elif turn == 'w':
			turn = 'b'
print(ans)


(n, m) = map(int, input().split())
table = [input() for i in range(n)]
ans = []
for i in range(n):
	tmp = []
	for j in range(m):
		if (i + j) % 2 == 0:
			tmp.append('B')
		else:
			tmp.append('W')
	ans.append(tmp)
for i in range(n):
	for j in range(m):
		if table[i][j] == '-':
			ans[i][j] = '-'
for i in range(n):
	print(''.join(ans[i]))


import sys

def helpf(x):
	if x[1] == '.':
		return x[0]
	else:
		return x[1]
x = sys.stdin.read()
ls = x.splitlines()
line1 = ls[0].split()
m = int(line1[0])
n = int(int(line1[1]) / 2 + 1)
bw = ['B', 'W'] * n
wb = ['W', 'B'] * n
bwwb = [bw, wb] * m
m1 = list(zip(bwwb, ls[1:]))
f1 = list(zip(m1[0][0], m1[0][1]))
m2 = []
for i in m1:
	m2.append(list(zip(i[0], i[1])))
m3 = []
for i in m2:
	m3.append(list(map(helpf, i)))
for i in m3:
	for j in i:
		print(j, end='')
	print()


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
ls = lambda : list(input().strip())
from collections import defaultdict as df
import heapq
infinite = float('inf')
(n, m) = RI()
l = [[0] * m for i in range(n)]
d = [[0] * m for i in range(n)]
for i in range(n):
	d[i] = ls()
seed = 0
if m % 2 == 0:
	for i in range(n):
		k = seed
		for j in range(m):
			if k % 2 == 0:
				if d[i][j] == '.':
					l[i][j] = 'B'
				else:
					l[i][j] = '-'
				k = (k + 1) % 2
			else:
				if d[i][j] == '.':
					l[i][j] = 'W'
				else:
					l[i][j] = '-'
				k = (k + 1) % 2
		seed = (seed + 1) % 2
else:
	k = 0
	for i in range(n):
		for j in range(m):
			if k % 2 == 0:
				if d[i][j] == '.':
					l[i][j] = 'B'
				else:
					l[i][j] = '-'
				k = (k + 1) % 2
			else:
				if d[i][j] == '.':
					l[i][j] = 'W'
				else:
					l[i][j] = '-'
				k = (k + 1) % 2
for i in range(n):
	print(*l[i], sep='')


(n, m) = [int(x) for x in input().split()]
lsf = []
lkj = []
for x in range(n):
	sth = input()
	for y in range(m):
		lkj = list(sth)
	lsf.append(lkj)
fg = 0
for i in range(n):
	for j in range(m):
		if lsf[i][j] == '.':
			if (j + i) % 2 == 0:
				lsf[i][j] = 'B'
			else:
				lsf[i][j] = 'W'
for i in range(n):
	for j in range(m):
		print(lsf[i][j], end='')
	print()


def dzy_loves_chessboard(n, m, d):
	p = 'W'
	b = 'W'
	for i in range(n):
		for j in range(m):
			if d[i][j] == '.':
				d[i][j] = p
			if p == 'W':
				p = 'B'
			else:
				p = 'W'
		if b == 'W':
			b = 'B'
			p = 'B'
		else:
			b = 'W'
			p = 'W'
	return d
(nn, mm) = list(map(int, input().split()))
dd = []
for i in range(nn):
	dd.append(list(input()))
z = dzy_loves_chessboard(nn, mm, dd)
for i in z:
	print(''.join(i))


(n, m) = map(int, input().split())
a = []
b = [[int(0) for i in range(m)] for j in range(n)]
for i in range(n):
	s = input()
	a.append(s)
for i in range(n):
	for j in range(m):
		if a[i][j] == '-':
			b[i][j] = '-'
for i in range(len(a)):
	p = a[i]
	for j in range(len(p)):
		if b[i][j] != '-':
			b[i][j] = 'B'
for i in range(0, n, 2):
	for j in range(0, m, 2):
		if b[i][j] != '-':
			b[i][j] = 'W'
for i in range(1, n, 2):
	for j in range(1, m, 2):
		if b[i][j] != '-':
			b[i][j] = 'W'
c = []
for i in range(n):
	c.append(''.join(b[i]))
for i in c:
	print(i)


(n, m) = [int(i) for i in input().split()]
l = []
s = []
for i in range(n):
	k = input()
	l.append(list(k))
for i in range(n):
	for j in range(m):
		if (i + j) % 2 == 0:
			if l[i][j] == '.':
				l[i][j] = 'B'
		elif l[i][j] == '.':
			l[i][j] = 'W'
for i in l:
	for j in range(len(i)):
		print(i[j], end='')
	print()


(n, m) = [int(c) for c in input().split(' ')]
chessboard = []
end = []
for _ in range(n):
	chessboard.append(list(input()))
for i in range(len(chessboard)):
	temp = []
	for j in range(len(chessboard[i])):
		if chessboard[i][j] == '.':
			if i % 2 == 0 and j % 2 == 0:
				temp.append('B')
			elif i % 2 == 1 and j % 2 == 0:
				temp.append('W')
			elif i % 2 == 0 and j % 2 == 1:
				temp.append('W')
			else:
				temp.append('B')
		else:
			temp.append('-')
	end.append(temp)
for elem in end:
	print(''.join(elem))


def getIn():
	return input().strip()
(n, m) = list(map(int, getIn().split(' ')))
board = [None for i in range(n)]
for i in range(n):
	row = list(getIn())
	board[i] = row
for i in range(n):
	for j in range(m):
		if board[i][j] == '-':
			print('-', end='')
		elif i % 2 == 0:
			if j % 2 == 0:
				print('W', end='')
			else:
				print('B', end='')
		elif j % 2 == 0:
			print('B', end='')
		else:
			print('W', end='')
	print()


from collections import defaultdict, deque, Counter, OrderedDict
from heapq import heappop, heappush
import bisect, sys, threading
(n, m) = (0, 0)
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
visited = [[0 for j in range(101)] for i in range(101)]

def dfs(a, x, y, w):
	if visited[x][y] == 1:
		return
	visited[x][y] = 1
	if a[x][y] == '.':
		a[x][y] = w
	w2 = 'W' if w == 'B' else 'B'
	for i in range(4):
		if 0 <= dx[i] + x < n and 0 <= dy[i] + y < m:
			dfs(a, dx[i] + x, dy[i] + y, w2)

def main():
	global n, m
	(n, m) = map(int, input().split())
	a = [['-' for j in range(m)] for i in range(n)]
	for i in range(n):
		s = input()
		a[i] = [c for c in s]
	dfs(a, 0, 0, 'B')
	for i in a:
		print(''.join(i))
sys.setrecursionlimit(200000)
threading.stack_size(10240000)
thread = threading.Thread(target=main)
thread.start()


(n, m) = [int(x) for x in input().split()]
matriz = []
ans = []
for i in range(n):
	matriz.append(input())
for i in range(n):
	string = ''
	for j in range(m):
		if matriz[i][j] == '.':
			if (i + j) % 2 == 0:
				string += 'B'
			else:
				string += 'W'
		else:
			string += '-'
	ans.append(string)
for i in ans:
	print(i)


w = 'BW'
(n, m) = map(int, input().split())
for j in range(n):
	line = input()
	outline = ''
	k = j % 2
	for (i, v) in enumerate(line):
		if v == '-':
			outline += '-'
		elif v == '.':
			outline += w[k]
		k = (k + 1) % 2
	print(outline)


(n, m) = map(int, input().split())
mat = list()
for i in range(n):
	mat.append(list())
	s = list(input())
	for j in range(m):
		if s[j] == '.':
			if (i + j) % 2 == 0:
				s[j] = 'B'
			else:
				s[j] = 'W'
	mat[i].append(''.join(s))
for i in range(n):
	print(*mat[i])


def checker(i, j, ans):
	can_place_one = True
	if i - 1 < 0 and j - 1 < 0:
		return 1
	if i - 1 >= 0:
		if ans[i - 1][j] == 1:
			can_place_one = False
	if j - 1 >= 0:
		if ans[i][j - 1] == 1:
			can_place_one = False
	if can_place_one:
		return 1
	else:
		return 0
(n, m) = list(map(int, input().split()))
boad = []
for i in range(n):
	boad.append(input())
ans = [['-' for j in range(m)] for i in range(n)]
for i in range(n):
	for j in range(m):
		if boad[i][j] == '.':
			if i % 2 == 0:
				if j % 2 == 0:
					ans[i][j] = 'W'
				else:
					ans[i][j] = 'B'
			elif j % 2 != 0:
				ans[i][j] = 'W'
			else:
				ans[i][j] = 'B'
[print(i) for i in [''.join(i) for i in ans]]


(n, m) = [int(x) for x in input().split()]
linhas = []
resultado = []
for i in range(n):
	linhas.append(input())
cor = ''
for i in range(n):
	if i % 2 == 0:
		cor = 'B'
	else:
		cor = 'W'
	s = []
	for j in range(m):
		if linhas[i][j] == '.':
			s.append(cor)
		else:
			s.append('-')
		if cor == 'B':
			cor = 'W'
		else:
			cor = 'B'
	print(''.join(s))


import math
(n, m) = map(int, input().split())
count = 0
lstn1 = ['B', 'W'] * int(math.ceil(m / 2))
lstn2 = ['W', 'B'] * int(math.ceil(m / 2))
for i in range(n):
	lst = list(input())
	if count % 2 == 0:
		for j in range(m):
			if lst[j] == '.':
				lst[j] = lstn1[j]
	else:
		for j in range(m):
			if lst[j] == '.':
				lst[j] = lstn2[j]
	print(''.join(lst))
	count += 1


(n, m) = map(int, input().split())
str = []
for _ in range(n):
	str.append(input())
for i in range(n):
	for j in range(m):
		if str[i][j] == '.':
			print('B' if (i + j) % 2 else 'W', end='')
		else:
			print('-', end='')
	print()


tab = [int(i) for i in input().split()]
for i in range(tab[0]):
	s = list(input())
	for j in range(tab[1]):
		if s[j] == '.':
			if (i + j) % 2 == 1:
				s[j] = 'W'
			else:
				s[j] = 'B'
	print(''.join(s))


(n, m) = map(int, input().split())
for i in range(n):
	row = list(input())
	for (j, c) in enumerate(row):
		if c == '.':
			if (i + j) % 2 == 0:
				row[j] = 'B'
			else:
				row[j] = 'W'
	print(''.join(row))


from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def main():
	(n, m) = mi()
	a = []
	for i in range(n):
		a.append(list(si()))
	f = 1
	x = ['W', 'B', 'W']
	for i in range(n):
		for j in range(m):
			if a[i][j] == '.':
				a[i][j] = x[i % 2 + j % 2]
	for i in range(n):
		print(''.join(a[i]))
main()


import sys
(n, m) = map(int, input().split())
result = ['' for i in range(n)]
for i in range(n):
	inp = input()
	for j in range(m):
		if inp[j] == '-':
			result[i] = result[i] + '-'
		elif i + j & 1:
			result[i] = result[i] + 'W'
		else:
			result[i] = result[i] + 'B'
for word in result:
	print(word)


(n, m) = map(int, input().split())
mat = []
temp = []
for i in range(0, n):
	temp = list(input())
	mat.append(temp)
	temp = []
res = ['B', 'W']
for i in range(n):
	for j in range(m):
		if mat[i][j] == '.':
			mat[i][j] = res[(i + j) % 2]
for i in range(n):
	t = mat[i]
	print(''.join(t))


(n, m) = list(map(int, input().split(' ')))
g = []
f = 0
for i in range(n):
	c = input()
	t = ''
	for j in range(m):
		if c[j] == '.' and f == 1:
			if j % 2 == 0:
				t += 'W'
			else:
				t += 'B'
		elif c[j] == '.' and f == 0:
			if j % 2 == 0:
				t += 'B'
			else:
				t += 'W'
		else:
			t += '-'
	g.append(t)
	if f == 1:
		f = 0
	else:
		f = 1
for i in g:
	for j in i:
		print(j, end='')
	print()


(n, m) = map(int, input().split())
fin = [list(input().strip()) for i in range(n)]
ans = [['-' for i in range(m)] for j in range(n)]
for y in range(n):
	for x in range(m):
		if fin[y][x] == '-':
			continue
		elif y % 2 == x % 2:
			ans[y][x] = 'B'
		else:
			ans[y][x] = 'W'
for row in ans:
	print(''.join(row))


a = input('').split(' ')
lines = []
i = 0
j = 0
iterator = 0
init = 0
for x in range(int(a[0])):
	b = input('')
	lines.append(b)
for val in lines:
	output = ''
	init = iterator
	for k in val:
		if k == '.':
			if (i + j) % 2 == 0:
				output += 'B'
				j = j + 1
			elif (i + j) % 2 == 1:
				output += 'W'
				j = j + 1
		else:
			output += '-'
			j = j + 1
	print(output)
	i = i + 1
	j = 0


(n, m) = map(int, input().split())
A = []
for i in range(n):
	s = input()
	A.append(s)
for i in range(n):
	for j in range(m):
		if A[i][j] == '.':
			if (i + j) % 2:
				A[i] = A[i].replace('.', 'W', 1)
			else:
				A[i] = A[i].replace('.', 'B', 1)
	print(A[i])


board = []
(row_count, column_count) = [int(i) for i in input().split()]
for i in range(row_count):
	board.append([i for i in input()])
for row in range(row_count):
	for column in range(column_count):
		if board[row][column] == '.':
			if (row + column) % 2 == 0:
				board[row][column] = 'B'
			else:
				board[row][column] = 'W'
for row in board:
	for column in row:
		print(column, end='')
	print()


(n, m) = [int(i) for i in input().split()]
f = []
for i in range(n):
	f.append(input())
flag = 1
for i in range(n):
	sub_flag = flag
	for j in range(m):
		if f[i][j] == '-':
			print('-', end='')
		elif sub_flag == 1:
			print('B', end='')
		elif sub_flag == -1:
			print('W', end='')
		sub_flag = -sub_flag
	flag = -flag
	print()


(n, m) = list(map(int, input().split()))
BOARD = []
A = ['B', 'W']
for i in range(n):
	BOARD = BOARD + [list(input())]
for i in range(n):
	for j in range(m):
		if BOARD[i][j] == '.':
			BOARD[i][j] = A[(i + j) % 2]
for i in range(n):
	print(''.join(BOARD[i]))


(n, m) = map(int, input().split())
row = []
for i in range(n):
	r = input()
	row.append(r)
out = []
c = True
for i in range(n):
	x = ''
	for j in range(m):
		if row[i][j] == '.':
			if (i + j) % 2 == 0:
				x += 'B'
			else:
				x += 'W'
		else:
			x += '-'
	print(x)


import math, string, sys
sys.setrecursionlimit(10 ** 7)

def LI():
	return list(map(int, sys.stdin.readline().split()))
(n, m) = LI()
box = []
opbox = []
for i in range(0, n):
	ip = input()
	box.append(ip)
bandw = ['B', 'W']
counter = 0
for i in range(0, n):
	optemp = ''
	for j in range(0, m):
		if box[i][j] == '.':
			optemp = optemp + bandw[counter]
		else:
			optemp = optemp + box[i][j]
		counter = 1 - counter
	if m % 2 == 0:
		counter = 1 - counter
	opbox.append(optemp)
for i in range(0, len(opbox)):
	print(opbox[i])


(n, m) = list(map(int, input().split()))
choice = ['B', 'W']
for i in range(n):
	arr = list(input())
	for j in range(m):
		if arr[j] == '.':
			arr[j] = choice[(i + j) % 2]
	print(''.join(arr))


board = []
(n, m) = map(int, input().split())
for i in range(n):
	word = str(input())
	x = []
	for letter in word:
		x.append(letter)
	board.append(x)
color_flag = True
previous = ''
row_even = 1
for i in range(n):
	if row_even % 2 != 0:
		for j in range(m):
			if board[i][j] == '.':
				if color_flag:
					board[i][j] = 'W'
				else:
					board[i][j] = 'B'
			color_flag = not color_flag
	else:
		for j in range(m - 1, -1, -1):
			if board[i][j] == '.':
				if color_flag:
					board[i][j] = 'W'
				else:
					board[i][j] = 'B'
			color_flag = not color_flag
	row_even += 1
for subset in board:
	res = ''
	for q in subset:
		res += q
	print(res)


(n, m) = map(int, input().split())
x = []
for i in range(n):
	x.append(input())
p = False
refs = ['B', 'W']
for i in range(n):
	for j in range(m):
		if x[i][j] == '.':
			x[i] = x[i].replace('.', refs[int(p)], 1)
		if j != m - 1 and m % 2 == 0:
			p = not p
		elif m % 2 != 0:
			p = not p
for i in x:
	print(i)


(n, m) = map(int, input().split())
chessboard = []
for i in range(n):
	chessboard.append([k for k in input()])
for i in range(n):
	for j in range(m):
		if chessboard[i][j] == '.':
			if (i + j) % 2 == 0:
				chessboard[i][j] = 'B'
			else:
				chessboard[i][j] = 'W'
for i in range(n):
	print(''.join(chessboard[i]))


(n, m) = map(int, input().split())
for i in range(n):
	line = input()
	out = ''
	for j in range(len(line)):
		if line[j] == '-':
			out += '-'
		elif (i + j) % 2 == 0:
			out += 'B'
		else:
			out += 'W'
	print(out)


(n, m) = map(int, input().split())
matrix = []
for i in range(n):
	s = input()
	a = []
	for j in range(m):
		if s[j] == '-':
			a.append(-1)
		elif i % 2 == 0:
			if j % 2 == 0:
				a.append(1)
			else:
				a.append(0)
		elif j % 2 == 0:
			a.append(0)
		else:
			a.append(1)
	matrix.append(a)
for i in range(n):
	for j in range(m):
		if matrix[i][j] == 0:
			print('B', end='')
		if matrix[i][j] == 1:
			print('W', end='')
		if matrix[i][j] == -1:
			print('-', end='')
	print()


(n, m) = map(int, input().split())
l = []
ans = []
a = 0
for i in range(n):
	s = input()
	x = ''
	l.append(s)
	if a == 0:
		st = 'B'
		pt = 'W'
	else:
		st = 'W'
		pt = 'B'
	for i in range(m):
		if i % 2 == 0:
			if s[i] == '-':
				x += '-'
			else:
				x += st
		elif s[i] == '-':
			x += '-'
		else:
			x += pt
	a ^= 1
	ans.append(x)
for i in ans:
	print(*i, sep='')


(N, M) = map(int, input().split())
X = []
for i in range(N):
	x = input()
	X.append(x)
ans = []
res = []
for i in range(N):
	if i % 2 == 0:
		flag = 1
	else:
		flag = 0
	for j in range(M):
		if X[i][j] == '.':
			if flag == 1:
				res.append('W')
			else:
				res.append('B')
		else:
			res.append('-')
		if flag == 0:
			flag = 1
		else:
			flag = 0
	ans.append(res)
	res = []
for i in ans:
	print(*i, sep='')


from operator import add
import queue
(n, m) = map(int, input().split())
board = []
for _ in range(n):
	board.append([c for c in input()])

def getNeighbours(i, j):
	dirs = [[-1, 0], [1, 0], [0, 1], [0, -1]]
	neis = []
	for di in dirs:
		nei = list(map(add, di, [i, j]))
		if nei[0] >= 0 and nei[0] < n and (nei[1] >= 0) and (nei[1] < m) and (board[nei[0]][nei[1]] == '.'):
			neis.append(nei)
	return neis
filled = [[False if board[i][j] == '.' else True for j in range(m)] for i in range(n)]

def bfs(i, j):
	queue = []
	queue.append((i, j, 'W'))
	while queue:
		(i, j, color) = queue.pop(0)
		neis = getNeighbours(i, j)
		color = 'B' if color == 'W' else 'W'
		for neib in neis:
			board[neib[0]][neib[1]] = color
			filled[neib[0]][neib[1]] = True
			neib.append(color)
			queue.append(neib)
	return
for i in range(n):
	for j in range(m):
		if not filled[i][j]:
			board[i][j] = 'W'
			filled[i][j] = True
			bfs(i, j)
for row in board:
	print(*row, sep='')


(r, c) = map(int, input().split())
chess = ['B', 'W']
for i in range(r):
	mylist = list(input())
	for j in range(c):
		if mylist[j] == '.':
			mylist[j] = chess[(i + j) % 2]
	print(''.join(mylist))


(n, m) = map(int, input().split())
matrix = []
for i in range(n):
	matrix.append(input())
for i in range(n):
	if i % 2 == 0:
		whitefirst = True
	else:
		whitefirst = False
	for j in range(m):
		if matrix[i][j] == '-':
			print('-', end='')
		elif whitefirst:
			if j % 2 == 0:
				print('W', end='')
			else:
				print('B', end='')
		elif j % 2 == 0:
			print('B', end='')
		else:
			print('W', end='')
	print()


(n, m) = map(int, input().split())
xadrez = []
for i in range(n):
	temp = input()
	lista = []
	for l in temp:
		lista.append(l)
	xadrez.append(lista)
saida = []
for i in range(n):
	saida.append('')
	for j in range(m):
		if i % 2 == 0:
			if j % 2 == 0:
				if xadrez[i][j] != '-':
					saida[i] += 'B'
				else:
					saida[i] += '-'
			elif xadrez[i][j] != '-':
				saida[i] += 'W'
			else:
				saida[i] += '-'
		elif j % 2 == 0:
			if xadrez[i][j] != '-':
				saida[i] += 'W'
			else:
				saida[i] += '-'
		elif xadrez[i][j] != '-':
			saida[i] += 'B'
		else:
			saida[i] += '-'
for l in saida:
	print(l)


(m, n) = map(int, input().split())
arr = []
for i in range(m):
	arr.append(list(input()))
for i in range(m):
	for j in range(n):
		if arr[i][j] == '.':
			if i + j & 1:
				arr[i][j] = 'W'
			else:
				arr[i][j] = 'B'
for i in arr:
	print(*i, sep='')


(a, b) = map(int, input().split())
t = []
for i in range(a):
	y = list(input())
	for j in range(b):
		if y[j] == '-':
			pass
		elif y[j] == '.':
			if i % 2 != 0:
				if j % 2 == 0:
					y[j] = 'B'
				else:
					y[j] = 'W'
			elif j % 2 != 0:
				y[j] = 'B'
			else:
				y[j] = 'W'
	t.append(y)
for k in t:
	print(''.join(k))


(n, m) = [int(x) for x in input('').split()]
l = []
for i in range(0, n):
	ar = list(str(input('')))
	if i % 2 == 0:
		for j in range(m):
			if j % 2 == 0 and ar[j] == '.':
				ar[j] = 'B'
			elif j % 2 != 0 and ar[j] == '.':
				ar[j] = 'W'
	else:
		for j in range(m):
			if j % 2 == 0 and ar[j] == '.':
				ar[j] = 'W'
			elif j % 2 != 0 and ar[j] == '.':
				ar[j] = 'B'
	l.append(ar)
for i in l:
	s = ''
	for x in i:
		s = s + x
	print(s)


mat = []
input_matrix = []
(n, m) = map(int, input().strip().split())
for i in range(0, n):
	input_matrix.append(input())
for i in range(0, n):
	mat.append([])
	for j in range(0, m):
		if input_matrix[i][j] == '.':
			if i % 2 == 0:
				if j % 2 == 0:
					mat[-1].append('B')
				else:
					mat[-1].append('W')
			elif j % 2 == 0:
				mat[-1].append('W')
			else:
				mat[-1].append('B')
		else:
			mat[-1].append('-')
for i in mat:
	print(''.join((str(x) for x in i)))


nm = input().split(' ')
n = int(nm[0])
m = int(nm[1])
chessboard = []
for i in range(n):
	row = list(input())
	chessboard.append(row)
for i in range(n):
	if i % 2 == 0:
		for j in range(m):
			if j % 2 == 0:
				if chessboard[i][j] != '-':
					chessboard[i][j] = 'W'
			elif chessboard[i][j] != '-':
				chessboard[i][j] = 'B'
			print(chessboard[i][j], end='')
	else:
		for j in range(m):
			if j % 2 == 0:
				if chessboard[i][j] != '-':
					chessboard[i][j] = 'B'
			elif chessboard[i][j] != '-':
				chessboard[i][j] = 'W'
			print(chessboard[i][j], end='')
	print('')


from math import sqrt

def dzy_loves_chessboard(n_int: int, m_int: int, chessboard_list: list) -> None:
	for row in range(n_int):
		line = ''
		if chessboard_list[row][0] == '-':
			line += '-'
		elif row % 2 == 0:
			line += 'W'
		else:
			line += 'B'
		for column in range(1, m_int):
			if chessboard_list[row][column] == '-':
				line += '-'
			elif row % 2 == 0 and column % 2 == 1:
				line += 'B'
			elif row % 2 == 1 and column % 2 == 1:
				line += 'W'
			elif row % 2 == 1 and column % 2 == 0:
				line += 'B'
			else:
				line += 'W'
		print(line)
	return
(n, m) = list(map(int, input().split()))
chessboard = [input() for i in range(n)]
dzy_loves_chessboard(n, m, chessboard)


(n, m) = map(int, input().split())
chess = []
for i in range(n):
	a = list(input())
	chess.append(a)
for i in range(n):
	for j in range(m):
		if chess[i][j] != '-':
			if i % 2 == 0 and j % 2 == 0:
				chess[i][j] = 'B'
			if i % 2 != 0 and j % 2 != 0:
				chess[i][j] = 'B'
			if i % 2 != 0 and j % 2 == 0:
				chess[i][j] = 'W'
			if i % 2 == 0 and j % 2 != 0:
				chess[i][j] = 'W'
for i in range(n):
	s = ''
	for j in range(m):
		s += chess[i][j]
	print(s)


(n, m) = map(int, input().split())
l = [[0] * m for i in range(n)]
for i in range(n):
	s = input()
	for j in range(m):
		l[i][j] = s[j]
for i in range(n):
	for j in range(m):
		if l[i][j] == '.':
			l[i][j] = 'W'
			q = [(i, j)]
			mn = []
			c = 1
			while q:
				(x, y) = q.pop()
				for (xd, yd) in ([1, 0], [0, 1], [-1, 0], [0, -1]):
					(a, b) = (x + xd, y + yd)
					if 0 <= a < n and 0 <= b < m and (l[a][b] == '.'):
						if c == 1:
							l[a][b] = 'B'
							mn.append([a, b])
						else:
							l[a][b] = 'W'
							mn.append([a, b])
				if len(q) == 0:
					q = mn[:]
					mn = []
					c = 1 - c
for i in l:
	for j in i:
		print(j, end='')
	print()


(n, m) = map(int, input().split())
b1 = 0
w = 0
for i in range(n):
	b = list(input())
	s = ''
	for j in range(m):
		if b[j] == '.':
			if b1 == 0:
				s += 'B'
				b1 = 1
				w = 1
			elif w == 1:
				s += 'W'
				b1 = 0
				w = 0
		else:
			s += '-'
			if b1 == 0 and w == 0:
				b1 = 1
				w = 1
			else:
				b1 = 0
				w = 0
	if m % 2 == 0:
		if b1 == 0 and w == 0:
			b1 = 1
			w = 1
		else:
			b1 = 0
			w = 0
	print(s)


ideal = []
a = list('BW' * 50)
b = list('WB' * 50)
grid = []
(n, m) = map(int, input().strip().split())
for i in range(n):
	grid.append(list(input().strip()))
for i in range(100):
	if i % 2 == 0:
		ideal.append(a)
	else:
		ideal.append(b)
for i in range(n):
	for j in range(m):
		if grid[i][j] == '.':
			grid[i][j] = ideal[i][j]
for i in range(n):
	print(''.join(grid[i]))


(n, m) = map(int, input().split())
F = 0
for i in range(n):
	x = input()
	if F % 2 == 0:
		First = 'W'
		Second = 'B'
	else:
		First = 'B'
		Second = 'W'
	for i in range(len(x)):
		if x[i] != '-':
			if i % 2 == 0:
				print(First, end='')
			else:
				print(Second, end='')
		else:
			print(x[i], end='')
	print()
	F += 1


neighbours = ((0, -1), (-1, 0), (0, 1), (1, 0))

def get_neighbours(mat, idx, idy, n, m, neighbour_val):
	ans = []
	for (n_x, n_y) in neighbours:
		if 0 <= idx + n_x < n and 0 <= idy + n_y < m and (mat[idx + n_x][idy + n_y] == '.'):
			ans.append((idx + n_x, idy + n_y, 'B' if neighbour_val == 'W' else 'W'))
	return ans

def main():
	(n, m) = map(int, input().split())
	mat = [list(input()) for _ in range(n)]
	for idx in range(n):
		for idy in range(m):
			if mat[idx][idy] == '.':
				mat[idx][idy] = 'B'
				tmp_stack = get_neighbours(mat, idx, idy, n, m, 'B')
				while tmp_stack:
					(x, y, v) = tmp_stack.pop()
					mat[x][y] = v
					tmp_stack.extend(get_neighbours(mat, x, y, n, m, v))
	print('\n'.join([''.join(x) for x in mat]))
main()


(n, m) = map(int, input().split(' '))
b = []
c = [[0] * m] * n
for x in range(0, n):
	s = input()
	a = list(s)
	b.append(a)
for x in range(0, n):
	for y in range(0, m):
		if x % 2 == 0:
			if b[x][y] == '.':
				if y % 2 == 0:
					print('B', end='')
				else:
					print('W', end='')
			else:
				print('-', end='')
		elif b[x][y] == '.':
			if y % 2 == 0:
				print('W', end='')
			else:
				print('B', end='')
		else:
			print('-', end='')
	print()


import sys
import math
(n, m) = [int(x) for x in sys.stdin.readline().split()]
arr = []
char = 'B'
for i in range(n):
	v = []
	st = sys.stdin.readline()
	for j in range(m):
		if st[j] == '.':
			if (j + i) % 2 == 0:
				v.append('B')
			else:
				v.append('W')
		else:
			v.append(st[j])
	print(''.join(v))


(n, m) = map(int, input().split())
board = []
for i in range(n):
	s = input()
	if i % 2 == 0:
		if m % 2 == 0:
			a = 'BW' * (m // 2)
		else:
			a = 'BW' * (m // 2) + 'B'
	elif m % 2 == 0:
		a = 'WB' * (m // 2)
	else:
		a = 'WB' * (m // 2) + 'W'
	ans = ''
	for j in range(m):
		if s[j] == '.':
			ans += a[j]
		else:
			ans += s[j]
	print(ans)


(n, m) = input().split(' ')
n = int(n)
m = int(m)
board = []
for i in range(0, n):
	for c in input():
		board.append(c)
if m % 2 == 0:
	x = True
	for i in range(0, n * m):
		if board[i] == '.':
			if x:
				board[i] = 'B'
				x = False
			else:
				board[i] = 'W'
				x = True
		else:
			x = not x
		if i % m == m - 1:
			x = not x
else:
	x = True
	for i in range(0, n * m):
		if board[i] == '.':
			if x:
				board[i] = 'B'
				x = False
			else:
				board[i] = 'W'
				x = True
		else:
			x = not x
for i in range(0, n * m):
	print(board[i], end='')
	if i % m == m - 1:
		print()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, m) = LI()
	a = [S() for _ in range(n)]
	rr = [['-'] * m for _ in range(n)]

	def f(i, j, bf):
		q = collections.deque()
		q.append((i, j, bf))
		while q:
			(i, j, bf) = q.pop()
			if i < 0 or i >= n or j < 0 or (j >= m) or (a[i][j] == '-'):
				continue
			if rr[i][j] != '-':
				continue
			if bf:
				rr[i][j] = 'B'
			else:
				rr[i][j] = 'W'
			q.append((i - 1, j, not bf))
			q.append((i + 1, j, not bf))
			q.append((i, j - 1, not bf))
			q.append((i, j + 1, not bf))
	for i in range(n):
		for j in range(m):
			f(i, j, True)
	return '\n'.join(map(lambda x: ''.join(x), rr))
print(main())


def dfs(M, x, y):
	stack = [[x, y]]
	m = len(M)
	n = len(M[0])
	M[x][y] = 'W'
	while len(stack) != 0:
		i = stack[-1][0]
		j = stack[-1][1]
		stack = stack[:-1]
		if i + 1 >= 0 and i + 1 < m and (j >= 0) and (j < n):
			if M[i + 1][j] == '.':
				if M[i][j] == 'W':
					M[i + 1][j] = 'B'
					stack.append([i + 1, j])
				else:
					M[i + 1][j] = 'W'
					stack.append([i + 1, j])
		if i - 1 >= 0 and i - 1 < m and (j >= 0) and (j < n):
			if M[i - 1][j] == '.':
				if M[i][j] == 'W':
					M[i - 1][j] = 'B'
					stack.append([i - 1, j])
				else:
					M[i - 1][j] = 'W'
					stack.append([i - 1, j])
		if i >= 0 and i < m and (j + 1 >= 0) and (j + 1 < n):
			if M[i][j + 1] == '.':
				if M[i][j] == 'W':
					M[i][j + 1] = 'B'
					stack.append([i, j + 1])
				else:
					M[i][j + 1] = 'W'
					stack.append([i, j + 1])
		if i >= 0 and i < m and (j - 1 >= 0) and (j - 1 < n):
			if M[i][j - 1] == '.':
				if M[i][j] == 'W':
					M[i][j - 1] = 'B'
					stack.append([i, j - 1])
				else:
					M[i][j - 1] = 'W'
					stack.append([i, j - 1])
	return M
(m, n) = map(int, input().split())
M = []
for i in range(m):
	s = input()
	M.append(list(s))
for i in range(m):
	for j in range(n):
		if M[i][j] == '.':
			M = dfs(M, i, j)
for i in range(m):
	for j in range(n):
		print(M[i][j], end='')
	print('')


(n, m) = map(int, input().split())
li = []
for i in range(n):
	s = list(input())
	li.append(s)
for i in range(n):
	for j in range(m):
		if li[i][j] == '.':
			if (i + j) % 2 == 0:
				li[i][j] = 'B'
			else:
				li[i][j] = 'W'
		print(li[i][j], end='')
	print()


(n, k) = map(int, input().split())
for j in range(n):
	s = input()
	for t in range(k):
		if s[t] == '-':
			print('-', end='')
		elif (j + t) % 2 == 0:
			print('W', end='')
		else:
			print('B', end='')
	print()


(n, m) = list(map(int, input().split(' ')))
board = []
for i in range(n):
	board.append([d for d in input()])
	for j in range(m):
		if board[i][j] == '.':
			if i + j & 1:
				board[i][j] = 'W'
			else:
				board[i][j] = 'B'
	print(''.join(board[i]))


(n, m) = (int(i) for i in input().split())
a = [['B' for i in range(m)] for j in range(n)]
for i in range(n):
	for j in range(m):
		if (i + j) % 2 == 1:
			a[i][j] = 'W'
for i in range(n):
	b = input()
	b = list(b)
	for j in range(m):
		if b[j] == '-':
			a[i][j] = '-'
for i in range(n):
	print(''.join(a[i]))


def valid(x, y):
	if (0 <= x < n and 0 <= y < m) and (not visited[x][y]) and (ls[x][y] == '.'):
		return True
	return False
mox = [1, -1, 0, 0]
moy = [0, 0, 1, -1]
(n, m) = map(int, input().split())
ls = []
for i in range(n):
	ls.append(list(input()))
visited = [[False for i in range(m)] for j in range(n)]
for i in range(n):
	for j in range(m):
		if valid(i, j):
			stack = [[i, j, 'W']]
			while len(stack):
				elem = stack.pop()
				ls[elem[0]][elem[1]] = elem[2]
				visited[elem[0]][elem[1]] = True
				if elem[2] == 'W':
					curr = 'B'
				else:
					curr = 'W'
				for k in range(4):
					if valid(elem[0] + mox[k], elem[1] + moy[k]):
						stack.append([elem[0] + mox[k], elem[1] + moy[k], curr])
for i in range(n):
	print(''.join(ls[i]))


line1 = input().split()
n = int(line1[0])
m = int(line1[1])
a = []
for i in range(n):
	a += [str(input())]
for i in range(n):
	for j in range(m):
		if a[i][j] == '.':
			if (i + j) % 2 == 0:
				print('B', end='')
			else:
				print('W', end='')
		else:
			print('-', end='')
	print()


(n, m) = map(int, input().split())
a = []
for _ in range(n):
	tmp = []
	st = input()
	for i in st:
		if i == '.':
			tmp.append(1)
		else:
			tmp.append(0)
	a.append(tmp)
for i in range(n):
	tmp = ''
	for j in range(m):
		if a[i][j] == 1:
			if (i - j) % 2 == 0:
				tmp += 'B'
			else:
				tmp += 'W'
		else:
			tmp += '-'
	print(tmp)


import sys
(n, m) = map(int, sys.stdin.readline().split())
option = ['B', 'W']
for i in range(n):
	row = [state for state in sys.stdin.readline()]
	for j in range(m):
		if row[j] == '.':
			row[j] = option[(i + j) % 2]
	sys.stdout.write(''.join(row))


import math
(r, c) = list(map(int, input().split()))
a = []
for i in range(r):
	a.append(input())
for i in range(r):
	for j in range(c):
		if a[i][j] == '.':
			if (i + j) % 2 == 0:
				print('B', end='')
			else:
				print('W', end='')
		else:
			print('-', end='')
	print('')


(n, m) = map(int, input().split())
chess = []
for i in range(n):
	l = list(input())
	for j in range(m):
		if l[j] == '.':
			if i + j & 1:
				l[j] = 'W'
			else:
				l[j] = 'B'
	for j in range(m):
		print(l[j], end='')
	print()


(a, b) = map(int, input().split())
c = []
for i in range(a):
	c += [input()]
	for j in range(b):
		if c[i][j] == '.':
			print(' BW'[(-1) ** (i + j)], end='')
		else:
			print('-', end='')
	print()


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, m) = map(int, input().split())
a = ['W', 'B']
for i in range(n):
	s = list(input())
	for j in range(m):
		if s[j] == '.':
			s[j] = a[(i + j) % 2]
	print(''.join(s))


(n, m) = map(int, input().split())
l = []
for i in range(n):
	s = input()
	e = list(s)
	l.append(e)
for i in range(n):
	a = 0
	b = 0
	if i % 2 == 0:
		for j in range(m):
			if l[i][j] == '.' and a == 0:
				l[i][j] = 'B'
				a = 1
				b = 0
			elif l[i][j] == '-' and a == 0:
				a = 1
				b = 0
			elif l[i][j] == '-' and b == 0:
				b = 1
				a = 0
			elif l[i][j] == '.' and b == 0:
				l[i][j] = 'W'
				b = 1
				a = 0
	else:
		for j in range(m):
			if l[i][j] == '.' and a == 0:
				l[i][j] = 'W'
				a = 1
				b = 0
			elif l[i][j] == '-' and a == 0:
				a = 1
				b = 0
			elif l[i][j] == '-' and b == 0:
				b = 1
				a = 0
			elif l[i][j] == '.' and b == 0:
				l[i][j] = 'B'
				b = 1
				a = 0
for i in range(n):
	for j in range(m):
		print(l[i][j], end='')
	print()


from array import *
(n, m) = map(int, input().split(' '))
l = []
for _ in range(n):
	s = input()
	l.append(list(s))
for i in range(n):
	for j in range(m):
		if l[i][j] == '.':
			if i + j & 1:
				l[i][j] = 'W'
			else:
				l[i][j] = 'B'
for i in range(n):
	ss = ''
	for j in range(m):
		ss += l[i][j]
	print(ss)


(p, q) = map(int, input().split())
l1 = []
for i in range(0, p):
	n = list(input())
	l1.append(n)
l4 = []
for i in range(0, p):
	l3 = []
	for j in range(0, q):
		if l1[i][j] == '.':
			if (i + 1) % 2 == 0 and (j + 1) % 2 == 0 or ((i + 1) % 2 != 0 and (j + 1) % 2 != 0):
				l3.append('B')
			else:
				l3.append('W')
		else:
			l3.append('-')
	l4.append(l3)
for x in l4:
	for y in x:
		print(y, end='')
	print()


(n, m) = map(int, input().split())
cells = []
for _ in range(n):
	cells.append(list(input()))
for i in range(n):
	for j in range(m):
		if cells[i][j] == '.':
			if (i + j) % 2 == 0:
				cells[i][j] = 'B'
			else:
				cells[i][j] = 'W'
for cell in cells:
	print(''.join(cell))


(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	res = ''
	for j in range(m):
		if (i + j) % 2 == 0 and s[j] != '-':
			res = res + 'B'
		elif (i + j) % 2 == 1 and s[j] != '-':
			res = res + 'W'
		else:
			res = res + '-'
	print(res)


a = input().split()
b = int(a[0])
c = int(a[1])
board = []
for x in range(0, b):
	board.append(list(input()))
for p in range(0, b):
	for q in range(0, c):
		if board[p][q] == '.':
			if (p + q) % 2 == 0:
				board[p][q] = 'B'
			else:
				board[p][q] = 'W'
for a in range(0, b):
	print(''.join(board[a]))


(a, b) = map(int, input().split())
for i in range(0, a):
	n = input()
	ans = ''
	for j in range(0, b):
		if n[j] == '.':
			if i + j & 1 == 1:
				ans = ans + 'B'
			else:
				ans = ans + 'W'
		else:
			ans = ans + n[j]
	print(ans)


class Code:

	def __init__(self):
		(self.n, self.m) = list(map(int, input().split()))
		self.arr = []
		for _ in range(self.n):
			self.arr.append(list(input()))

	def process(self):
		for i in range(self.n):
			for j in range(self.m):
				if self.arr[i][j] == '.':
					self.arr[i][j] = 'W' if (i + j) % 2 == 1 else 'B'
		for (i, row) in enumerate(self.arr):
			for (j, ch) in enumerate(row):
				print(ch, end='')
			print()
code = Code()
code.process()


(n, m) = map(int, input().split())
out = []
for _ in range(n):
	o = []
	for (i, x) in enumerate(list(input())):
		if x == '.':
			if _ % 2 and (not i % 2) or (not _ % 2 and i % 2):
				o.append('B')
			else:
				o.append('W')
		else:
			o.append('-')
	out.append(o)
for l in out:
	print(''.join(l))


(n, m) = map(int, input().split())
matr = [list(input()) for i in range(n)]
(item, item2) = ('B', 'B')
for (i, x) in enumerate(matr):
	for (j, y) in enumerate(x):
		if y == '.':
			matr[i][j] = item
		if item == 'B':
			item = 'W'
		else:
			item = 'B'
	if item2 == 'B':
		(item, item2) = ('W', 'W')
	else:
		(item, item2) = ('B', 'B')
for (i, x) in enumerate(matr):
	print(''.join(x))


(n, m) = map(int, input().split())
x = []
for i in range(n):
	a = list(input())
	x.append(a)
for i in range(n):
	for j in range(m):
		if (i + j) % 2 == 1 and x[i][j] == '.':
			x[i][j] = 'W'
		if (i + j) % 2 == 0 and x[i][j] == '.':
			x[i][j] = 'B'
for i in x:
	print(''.join(i))


inp = lambda : map(int, input().split())
(n, m) = inp()
for i in range(n):
	s = input()
	l = []
	for j in range(len(s)):
		if s[j] == '-':
			l.append('-')
			continue
		if i % 2 == 0 and j % 2 == 0 or (i % 2 != 0 and j % 2 != 0):
			l.append('B')
		if i % 2 != 0 and j % 2 == 0 or (i % 2 == 0 and j % 2 != 0):
			l.append('W')
	print(''.join(l))


import heapq

def calc(n, m, q):
	matrix = []
	for (i, row) in enumerate(q):
		s = ''
		is_odd = i % 2 != 0
		for (j, char) in enumerate(row):
			if char == '-':
				s += '-'
			elif (is_odd and j % 2 == 0) | (not is_odd and j % 2 != 0):
				s += 'W'
			else:
				s += 'B'
		matrix.append(s)
	return matrix
(n, m) = map(int, input().split())
q = []
for _ in range(n):
	q.append(input())
matrix = calc(n, m, q)
for line in matrix:
	print(line)


(n, m) = list(map(int, input().split()))
ans = []
wb = ['W', 'B']
for i in range(n):
	arr = list(input())
	for g in range(m):
		if arr[g] != '-':
			arr[g] = wb[int(i & 1 ^ g & 1)]
	ans.append(arr)
for i in range(n):
	print(*ans[i], sep='')


(n, m) = map(int, input().split())
mtrx = []
for _ in range(n):
	mtrx.append(list(input()))
for i in range(n):
	for j in range(m):
		if mtrx[i][j] != '-':
			mtrx[i][j] = 'W' if (i + j) % 2 else 'B'
for row in mtrx:
	print(''.join(row))


(n, m) = input().split()
n = int(n)
m = int(m)
f = ['-'] * (n + 2)
for i in range(n + 2):
	f[i] = ['-'] * (m + 2)
for i in range(1, n + 1):
	s = input()
	for j in range(1, m + 1):
		f[i][j] = s[j - 1]
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if f[i][j] == '.' and (i + j) % 2 == 0:
			f[i][j] = 'B'
		elif f[i][j] == '.':
			f[i][j] = 'W'
for i in range(1, n + 1):
	s = ''
	for j in range(1, m + 1):
		s += str(f[i][j])
	print(s)


def DFS(matrix, n, m, x, y, visited):
	stack = [(x, y)]
	visited = [[0 for i in range(m)] for j in range(n)]
	while len(stack):
		temp = tuple(stack.pop())
		visited[temp[0]][temp[1]] = 1
		if temp[0] > 0 and visited[temp[0] - 1][temp[1]] == 0 and (matrix[temp[0] - 1][temp[1]] == '.'):
			if matrix[temp[0]][temp[1]] == 'B':
				matrix[temp[0] - 1][temp[1]] = 'W'
			if matrix[temp[0]][temp[1]] == 'W':
				matrix[temp[0] - 1][temp[1]] = 'B'
			stack.append((temp[0] - 1, temp[1]))
		if temp[0] < n - 1 and visited[temp[0] + 1][temp[1]] == 0 and (matrix[temp[0] + 1][temp[1]] == '.'):
			if matrix[temp[0]][temp[1]] == 'B':
				matrix[temp[0] + 1][temp[1]] = 'W'
			if matrix[temp[0]][temp[1]] == 'W':
				matrix[temp[0] + 1][temp[1]] = 'B'
			stack.append((temp[0] + 1, temp[1]))
		if temp[1] > 0 and visited[temp[0]][temp[1] - 1] == 0 and (matrix[temp[0]][temp[1] - 1] == '.'):
			if matrix[temp[0]][temp[1]] == 'B':
				matrix[temp[0]][temp[1] - 1] = 'W'
			if matrix[temp[0]][temp[1]] == 'W':
				matrix[temp[0]][temp[1] - 1] = 'B'
			stack.append((temp[0], temp[1] - 1))
		if temp[1] < m - 1 and visited[temp[0]][temp[1] + 1] == 0 and (matrix[temp[0]][temp[1] + 1] == '.'):
			if matrix[temp[0]][temp[1]] == 'B':
				matrix[temp[0]][temp[1] + 1] = 'W'
			if matrix[temp[0]][temp[1]] == 'W':
				matrix[temp[0]][temp[1] + 1] = 'B'
			stack.append((temp[0], temp[1] + 1))
(n, m) = map(int, input().split())
chessboard = []
for i in range(n):
	col = input()
	temp = []
	for j in col:
		temp.append(j)
	chessboard.append(temp)
visited = [[0 for i in range(m)] for j in range(n)]
for i in range(n):
	for j in range(m):
		if visited[i][j] == 1:
			continue
		elif chessboard[i][j] == '.':
			chessboard[i][j] = 'B'
			q = 'B'
			DFS(chessboard, n, m, i, j, visited)
for i in chessboard:
	print(''.join(i))


from sys import stdin, stdout, setrecursionlimit
input = stdin.readline
flush = stdout.flush
OUT = []

def write(item, sep=' '):
	if type(item) is int:
		OUT.append(str(item))
	elif type(item) is list:
		if type(item[0]) is int:
			OUT.append(sep.join(map(str, item)))
		else:
			OUT.append(sep.join(item))
	else:
		OUT.append(item)

def PRINT():
	print('\n'.join(OUT))
GI = lambda : int(input())
GS = lambda : input()[:-1]
gi = lambda : list(map(int, input().split()))
gs = lambda : input().split()
(n, m) = gi()
arr = []
for i in range(n):
	write(''.join(('WB'[i % 2 ^ j % 2] if k == '.' else k for (j, k) in enumerate(GS()))))
PRINT()


(n, m) = map(int, input().split())
l = []
k = []
for i in range(n):
	l.append(input())
for i in range(n):
	if i % 2 == 0:
		k.append('WB' * m)
		k[i] = k[i][:m]
	else:
		k.append('BW' * m)
		k[i] = k[i][:m]
for i in range(n):
	for j in range(m):
		if l[i][j] == '-':
			k[i] = k[i][:j] + '-' + k[i][j + 1:]
for i in range(n):
	print(k[i])


(n, m) = map(int, input().split())
s = [input() for _ in range(n)]
S = ''
for i in range(n):
	for j in range(m):
		S += [['B', 'W'][(i + j) % 2], '-'][s[i][j] == '-']
	print(S)
	S = ''


(n, m) = map(int, input().split())
b = []
for i in range(n):
	a = list(input())
	b.append(a)
aa = []
for i in range(m // 2):
	aa.append('B')
	aa.append('W')
for i in range(m % 2):
	aa.append('B')
bb = []
for i in range(m // 2):
	bb.append('W')
	bb.append('B')
for i in range(m % 2):
	bb.append('W')
cc = []
for i in range(n // 2):
	cc.append(aa)
	cc.append(bb)
for i in range(n % 2):
	cc.append(aa)
cooh = []
for i in range(n):
	z = []
	for j in range(m):
		z.append(cc[i][j])
	cooh.append(z)
for i in range(n):
	for j in range(m):
		if b[i][j] == '-':
			cooh[i][j] = '-'
for ele in cooh:
	print(*ele, sep='')


def main():
	(n, m) = map(int, input().split())
	grid = []
	for _ in range(n):
		grid.append(list(input()))
	chars = 'BW'
	for i in range(n):
		for j in range(m):
			if grid[i][j] == '.':
				grid[i][j] = chars[(i + j) % 2]
	for row in grid:
		print(''.join(row))
main()


import sys, os
from collections import defaultdict
from math import gcd, sqrt
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))

def main():
	(n, m) = read()
	mat = [list(input().strip()) for i in range(n)]
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '.':
				mat[i][j] = ['W', 'B'][(i % 2 + j) % 2]
	for i in mat:
		print(''.join(i))
main()


(n, m) = map(int, input().split(' '))
myl = []
for i in range(n):
	l = input()
	myl.append(l)
t = 1
myl2 = []
for i in range(n):
	s = ''
	t = 1 + i
	for j in range(m):
		if myl[i][j] == '.':
			if t % 2 == 0:
				s += 'B'
			else:
				s += 'W'
		else:
			s += myl[i][j]
		t += 1
	myl2.append(s)
for i in myl2:
	print(i)


(n, m) = map(int, input().split())
k = list((input() for _ in range(n)))
ans = []
for i in range(n):
	l = ''
	for j in range(m):
		if j != 0 and i != 0:
			if l[j - 1] != 'B' and ans[i - 1][j] != 'B':
				l += 'B'
			else:
				l += 'W'
		elif j != 0:
			if l[j - 1] != 'B':
				l += 'B'
			else:
				l += 'W'
		elif i != 0:
			if ans[i - 1][j] != 'B':
				l += 'B'
			else:
				l += 'W'
		else:
			l += 'B'
	l = list(l)
	ans.append(l)
for i in range(n):
	for j in range(m):
		if k[i][j] == '-':
			ans[i][j] = '-'
for x in range(n):
	for y in range(m):
		print(ans[x][y], end='')
	print()


(n, m) = map(int, input().split())
matrix = []
for i in range(n):
	matrix.append(list(input()))
for i in range(n):
	for j in range(m):
		if matrix[i][j] == '.':
			if i % 2 == 0:
				if j % 2 == 0:
					matrix[i][j] = 'B'
				else:
					matrix[i][j] = 'W'
			elif j % 2 == 0:
				matrix[i][j] = 'W'
			else:
				matrix[i][j] = 'B'
for line in matrix:
	print(*line, sep='')


(n, m) = map(int, input().split())
l1 = []
for i in range(n):
	l2 = list(input())
	for j in range(m):
		if l2[j] == '.':
			if (i + j) % 2 == 0:
				l2[j] = 'W'
			else:
				l2[j] = 'B'
	l1.append(l2)
for item in l1:
	print(''.join(item))


(n, m) = map(int, input().split())
f = 0
for _ in range(n):
	i = input()
	s = ''
	if f == 0:
		if m % 2 == 1:
			s = 'BW' * (m // 2) + 'B'
		else:
			s = 'BW' * (m // 2 + 1)
		for j in range(m):
			if i[j] == '.':
				print(s[j], end='')
			else:
				print(i[j], end='')
	else:
		if m % 2 == 1:
			s = 'WB' * (m // 2) + 'W'
		else:
			s = 'WB' * (m // 2 + 1)
		for k in range(m):
			if i[k] == '.':
				print(s[k], end='')
			else:
				print(i[k], end='')
	f = 1 - f
	print()


(n, m) = [int(i) for i in input().split()]
a = [[j for j in input()] for i in range(n)]
b = [['.' for j in range(m)] for i in range(n)]
for i in range(n):
	for j in range(m):
		if b[i][j] == '.':
			if i == 0:
				if j == 0:
					b[i][j] = 'B'
				elif j == m - 1:
					if b[i][j - 1] == 'B':
						b[i][j] = 'W'
					else:
						b[i][j] = 'B'
				elif b[i][j - 1] == 'B':
					b[i][j] = 'W'
				else:
					b[i][j] = 'B'
			elif i == n - 1:
				if j == 0:
					if b[i - 1][j] == 'B':
						b[i][j] = 'W'
					else:
						b[i][j] = 'B'
				elif j == m - 1:
					if b[i][j - 1] == 'B':
						b[i][j] = 'W'
					else:
						b[i][j] = 'B'
				elif b[i][j - 1] == 'B':
					b[i][j] = 'W'
				else:
					b[i][j] = 'B'
			elif j == 0:
				if b[i - 1][j] == 'B':
					b[i][j] = 'W'
				else:
					b[i][j] = 'B'
			elif j == m - 1:
				if b[i][j - 1] == 'B':
					b[i][j] = 'W'
				else:
					b[i][j] = 'B'
			elif b[i][j - 1] == 'B':
				b[i][j] = 'W'
			else:
				b[i][j] = 'B'
			if a[i][j] == '.':
				a[i][j] = b[i][j]
for i in a:
	print(''.join(i))


def chess(n, m, a):
	c = 0
	for i in range(n):
		if m % 2 == 0:
			c += 1
		for j in range(m):
			c += 1
			if a[i][j] == '.':
				if c % 2 == 0:
					a[i][j] = 'B'
				else:
					a[i][j] = 'W'
	return a
(n, m) = map(int, input().split())
a = []
for i in range(n):
	mat = list(input())
	a.append(mat)
ans = chess(n, m, a)
for i in ans:
	print(''.join(i))


def arr_inp():
	return [int(x) for x in stdin.readline().split()]

def str_inp(n):
	return [list(input()) for x in range(n)]

def flip(x):
	return 'W' if x == 'B' else 'B'
from sys import stdin
(n, m) = arr_inp()
(chess, x, ter) = (str_inp(n), 'W', '')
for i in range(n):
	if i & 1:
		x = 'B'
	else:
		x = 'W'
	for j in range(m):
		if chess[i][j] == '.':
			chess[i][j] = x
		if j == m - 1:
			ter = '\n'
		else:
			ter = ''
		print(chess[i][j], end=ter)
		x = flip(x)


(n, m) = map(int, input().split())
s = list('WB' * (m // 2) + 'W' * (m % 2))
s_inv = list('BW' * (m // 2) + 'B' * (m % 2))
order = [s if i % 2 == 0 else s_inv for i in range(n)]
inp = []
for i in range(n):
	inp.append(list(input()))
for i in range(n):
	for j in range(m):
		if inp[i][j] == '.':
			inp[i][j] = order[i][j]
		else:
			inp[i][j] = '-'
for i in range(n):
	print(''.join(inp[i]))


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	listt = input().strip()
	arr.append(listt)
for i in range(n):
	for j in range(m):
		if arr[i][j] == '.':
			if (i + j) % 2:
				print('W', end='')
			else:
				print('B', end='')
		else:
			print(arr[i][j], end='')
	print()


board = []
board2 = []
good_cells = []
mx = 101

def isGood(x, y):
	if board[x][y] != -1:
		return True
	return False

def sum(li):
	cnt = 0
	for (x, y) in li:
		cnt += board[x][y]
	return cnt

def isOk(x, y):
	if isValid(board[x][y]) and isGood(board[x][y]):
		return True
	return False

def adj_list(x, y):
	li = []
	dx = [0, 0, 1, -1]
	dy = [1, -1, 0, 0]
	for i in range(4):
		if isOk(x + dx[i], y + dy[i]):
			li.append([x + dx[i], y + dy[i]])
	return li

def isValid(x, y):
	if x >= 0 and x < n and (y >= 0) and (y < m):
		return True
	return False

def process(line):
	tmp = []
	for x in line:
		if x == '.':
			tmp.append(0)
		else:
			tmp.append(-1)
	return tmp

def list_good_cell(row, x):
	for i in range(len(row)):
		if row[i] == '.':
			y = i
			cell = [x, y, False]
			good_cells.append(cell)
(n, m) = map(int, input().split())
for i in range(n):
	line = list(input().strip())
	board2.append(line)
	board.append(process(line))
for i in range(n):
	for j in range(m):
		sum = 0
		if isValid(i - 1, j) and isGood(i - 1, j):
			sum += board[i - 1][j]
		if isValid(i, j - 1) and isGood(i, j - 1):
			sum += board[i][j - 1]
		if sum == 0:
			board[i][j] = 1
		else:
			board[i][j] = 0
for i in range(n):
	for j in range(m):
		x = board[i][j]
		y = board2[i][j]
		if y == '.':
			if x == 0:
				print('W', end='')
			elif x == 1:
				print('B', end='')
		else:
			print('-', end='')
	print('')


(n, m) = input().strip().split()
n = int(n)
m = int(m)
c = []
for i in range(n):
	temp = input()
	c.append(list(temp))
for i in range(n):
	for j in range(m):
		if divmod(i + 1, 2)[1] != 0:
			if divmod(j + 1, 2)[1] != 0:
				if c[i][j] == '.':
					c[i][j] = 'B'
			elif c[i][j] == '.':
				c[i][j] = 'W'
		elif divmod(j + 1, 2)[1] != 0:
			if c[i][j] == '.':
				c[i][j] = 'W'
		elif c[i][j] == '.':
			c[i][j] = 'B'
for i in range(n):
	for j in range(m):
		print(c[i][j], end='')
	print()


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
for i in range(n):
	for j in range(m):
		if a[i][j] is '.':
			print('W' if (i + j) % 2 else 'B', end='')
		else:
			print('-', end='')
	print()


(n, m) = map(int, input().split())
gb = []
for _ in range(n):
	gb.append(input())
bwl1 = 'WB' * (m // 2) + 'W' * (m & 1)
bwl2 = 'BW' * (m // 2) + 'B' * (m & 1)
bw = [bwl1, bwl2] * (n // 2)
if n & 1:
	bw.append(bwl1)
for i in range(n):
	for j in range(m):
		if gb[i][j] == '.':
			print(bw[i][j], end='')
		else:
			print('-', end='')
	print()


(n, m) = map(int, input().split())
matrix = []
for i in range(n):
	row = input()
	row_filled = ['B' if (i + j) % 2 == 0 else 'W' for j in range(m)]
	matrix.append(['-' if row[j] == '-' else row_filled[j] for j in range(m)])
for row in matrix:
	print(''.join(row))


(n, m) = map(int, input().split())
s = [list(input()) for i in range(n)]
k = (m + 1) // 2
a = ['WB' * k, 'BW' * k]
for i in range(n):
	print(''.join((a[i % 2][j] if s[i][j] == '.' else '-' for j in range(m))))


num = list(map(int, input().split()))
n = num[0]
m = num[1]
board = []
for x in range(n):
	board.append(input())
for x in range(n):
	for y in range(m):
		if board[x][y] == '.':
			if x % 2 == 0:
				if y % 2 == 0:
					print('B', end='')
				else:
					print('W', end='')
			elif y % 2 == 0:
				print('W', end='')
			else:
				print('B', end='')
		else:
			print('-', end='')
	print()


(n, m) = [int(x) for x in input().split()]
for i in range(n):
	s = list(input())
	for j in range(m):
		if s[j] == '.':
			s[j] = 'B' if (i + j) % 2 else 'W'
	print(''.join(s))


data = input().split()
(N, M) = (int(data[0]), int(data[1]))
chess = [None] * N
for i in range(N):
	chess[i] = input()
answer = [None] * N
for i in range(N):
	new = [None] * M
	for j in range(M):
		if chess[i][j] == '.':
			if (i + j) % 2 == 0:
				new[j] = 'W'
			else:
				new[j] = 'B'
		elif chess[i][j] == '-':
			new[j] = '-'
	answer[i] = ''.join(new)
print('\n'.join(map(str, answer)))


(n, m) = map(int, input().split())
L = []
for i in range(n):
	L.append([i for i in input()])
res = [[0 for i in range(m)] for j in range(n)]
for i in range(n):
	for j in range(m):
		if i % 2 == 0:
			if j % 2 == 0:
				res[i][j] = 'W'
			else:
				res[i][j] = 'B'
		elif j % 2 == 0:
			res[i][j] = 'B'
		else:
			res[i][j] = 'W'
for i in range(n):
	for j in range(m):
		if L[i][j] == '-':
			print('-', end='')
		else:
			print(res[i][j], end='')
	print()


def dzyLovesChess():
	s = [int(x) for x in input().split()]
	(n, m) = (s[0], s[1])
	chessboard = []
	chessboard.append(['-' for i in range(m + 2)])
	for i in range(n):
		chessboard.append(['-'] + list(input()) + ['-'])
	chessboard.append(['-' for i in range(m + 2)])
	for i in range(1, n + 2):
		for j in range(1, m + 2):
			if (chessboard[i][j] == '.' or chessboard[i][j] == 'bl') and (i + j) % 2 == 0:
				chessboard[i][j] = 'B'
				if chessboard[i + 1][j] == '.':
					chessboard[i + 1][j] = 'wl'
				if chessboard[i - 1][j] == '.':
					chessboard[i - 1][j] = 'wl'
				if chessboard[i][j + 1] == '.':
					chessboard[i][j + 1] = 'wl'
				if chessboard[i][j - 1] == '.':
					chessboard[i][j - 1] = 'wl'
			elif (chessboard[i][j] == 'wl' or chessboard[i][j] == '.') and (i + j) % 2 != 0:
				chessboard[i][j] = 'W'
				if chessboard[i + 1][j] == '.':
					chessboard[i + 1][j] = 'bl'
				if chessboard[i - 1][j] == '.':
					chessboard[i - 1][j] = 'bl'
				if chessboard[i][j + 1] == '.':
					chessboard[i][j + 1] = 'bl'
				if chessboard[i][j - 1] == '.':
					chessboard[i][j - 1] = 'bl'
	for i in range(1, n + 1):
		for j in range(1, m + 1):
			print(chessboard[i][j], end='')
		print()
dzyLovesChess()


l = lambda : map(int, input().split())
(n, m) = l()
c = True
for i in range(n):
	t = c
	s = [*input()]
	for i in range(m):
		if s[i] == '.' and c:
			s[i] = 'W'
			c = not c
		elif s[i] == '-':
			c = not c
		elif s[i] == '.' and (not c):
			s[i] = 'B'
			c = not c
	if c == t:
		c = not c
	print(''.join(s))


(n, m) = map(int, input().split())
result = []
for i in range(n):
	s = ''
	for (j, el) in enumerate(input()):
		s += el if el == '-' else 'WB'[(i + j) % 2]
	result.append(s)
print('\n'.join(result))


(n, m) = map(int, input().split())
f = []
k = 1
l = 1
for x in range(n):
	s = list(input())
	if x % 2 == 0:
		for y in range(len(s)):
			if k:
				if s[y] == '.':
					s[y] = 'W'
				k = 0
			else:
				if s[y] == '.':
					s[y] = 'B'
				k = 1
		k = 1
	else:
		for y in range(len(s)):
			if l:
				if s[y] == '.':
					s[y] = 'B'
				l = 0
			else:
				if s[y] == '.':
					s[y] = 'W'
				l = 1
		l = 1
	f.append(s)
for i in f:
	print(''.join(i))


(n, m) = map(int, input().split())
rows = []
x = 1
for _ in range(n):
	r = ''
	b = x * -1
	for i in input():
		if i == '.':
			r += 'B' if b > 0 else 'W'
		else:
			r += i
		b *= -1
	rows.append(r)
	x *= -1
print('\n'.join(rows))


import sys

class InputIterator:

	def __init__(self, s):
		self.list = s.split()
		self.i = 0

	def __iter__(self):
		return self

	def __next__(self):
		if self.i >= len(self.list):
			raise StopIteration
		res = self.list[self.i]
		self.i += 1
		return res

	def has_next(self):
		return self.i < len(self.list)

class Solver:

	def __init__(self, input_iter):
		self.input_iter = input_iter
		self.grid = []

	def input(self):
		(self.n, self.m) = map(int, [next(self.input_iter), next(self.input_iter)])
		for i in range(self.n):
			self.grid.append(next(self.input_iter))
		return self

	def mat(self, h, w, value=False):
		return [[value for c in range(w)] for r in range(h)]

	def solve(self):
		self.ok = self.mat(self.n, self.m, True)
		for r in range(self.n):
			for c in range(self.m):
				if self.grid[r][c] == '-':
					self.ok[r][c] = False
		self.color = self.mat(self.n, self.m, False)
		for r in range(self.n):
			for c in range(self.m):
				self.color[r][c] = (r % 2 == 0) == (c % 2 == 0)
		return self

	def output(self):
		for r in range(self.n):
			for c in range(self.m):
				color = 'W' if self.color[r][c] else 'B'
				print(color if self.ok[r][c] else '-', end='')
			print('')
		return self

def run(input_iter):
	while input_iter.has_next():
		solver = Solver(input_iter)
		solver.input().solve().output()
run(InputIterator(sys.stdin.read()))


(a, b) = map(int, input().split())
for i in range(a):
	x = ''
	z = input()
	for j in range(b):
		if z[j] == '.':
			x += 'BW'[i + j & 1]
		else:
			x += z[j]
	print(x)


(n, m) = [int(x) for x in input().split()]
board = []
for i in range(n):
	board.append(list(input()))
for i in range(n):
	for j in range(m):
		if board[i][j] == '.':
			if (i + j) % 2 == 0:
				board[i][j] = 'B'
			else:
				board[i][j] = 'W'
for row in board:
	for cell in row:
		print(cell, end='')
	print()


g = []
n = -1
m = -1
s = input().split()
n = int(s[0])
m = int(s[1])
mp = [[0 for i in range(m)] for j in range(n)]
for k in range(n):
	g.append(input())
for i in range(n):
	for j in range(m):
		if g[i][j] == '.':
			if i % 2 == 0:
				if j % 2 == 0:
					g[i] = g[i][:j] + 'W' + g[i][j + 1:]
				else:
					g[i] = g[i][:j] + 'B' + g[i][j + 1:]
			elif j % 2 != 0:
				g[i] = g[i][:j] + 'W' + g[i][j + 1:]
			else:
				g[i] = g[i][:j] + 'B' + g[i][j + 1:]
for i in range(n):
	print(g[i])


(n, m) = map(int, input().split())
j = 0
for _ in range(n):
	a = list(input())
	j += 1
	for i in range(len(a)):
		if j % 2 == 1 and i % 2 == 0 and (a[i] == '.'):
			a[i] = 'B'
		if j % 2 == 0 and i % 2 == 0 and (a[i] == '.'):
			a[i] = 'W'
		if j % 2 == 1 and i % 2 == 1 and (a[i] == '.'):
			a[i] = 'W'
		if j % 2 == 0 and i % 2 == 1 and (a[i] == '.'):
			a[i] = 'B'
	print(''.join(a))


(numRows, numCols) = input().strip().split(' ')
(numRows, numCols) = (int(numRows), int(numCols))
board = []
for i in range(numRows):
	temp = []
	a = input()
	for j in a:
		temp.append(j)
	board.append(temp)
alternate_arr = ['W', 'B']
counter = 0
model = []
for i in range(numRows):
	temp = []
	for j in range(numCols):
		if i == 0 and j == 0:
			temp.append('W')
		elif j - 1 >= 0:
			if temp[-1] == 'W':
				temp.append('B')
			else:
				temp.append('W')
		elif i - 1 >= 0:
			if model[i - 1][j] == 'W':
				temp.append('B')
			else:
				temp.append('W')
	model.append(temp)
for i in range(numRows):
	for j in range(numCols):
		if board[i][j] == '.':
			board[i][j] = model[i][j]
for i in board:
	print(''.join(i))