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

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='')


(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())
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())
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):
	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())
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) = 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='')


(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) = [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()


(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))


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) = 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='')


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())
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)


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]))


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) = 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]))


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('')


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) = [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)


(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)


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) = 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))


(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) = 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))


(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))


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())
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)))


(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]))


(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()


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)]))


(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)


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())
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='')


(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)]))


(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)


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[_]))


(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]))


[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('')


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='')


(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 = []
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))


(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()


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) = [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)


(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
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()


(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))


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])


(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


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


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


(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())
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='')


(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())
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='')


(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)))


(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())
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(' '))
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()


(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, 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]))


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()


(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]))


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())
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) = 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)


(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()


(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())
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))


(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())
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))


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()


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()


(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()


(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))