#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int n, m, i, j;
  char c;
  scanf("%d %d\n", &n, &m);
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= m; ++j) {
      c = getchar();
      printf("%c", c == '.' ? ((i + j) % 2 ? 'W' : 'B') : c);
    }
    getchar();
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ff <main+0xcf>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11dc <main+0xac>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x2e,%eax
jne    11b6 <main+0x86>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x42,%eax
mov    $0x57,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bd <main+0x8d>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <main+0x3d>
mov    $0x0,%al
call   1040 <getchar@plt>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115a <main+0x2a>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11cb <main+0x9b>
mov    $0x1,%r14d
mov    $0x2,%ebx
mov    $0x42,%r15d
jmp    1192 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r14),%eax
add    $0x1,%ebx
cmp    0x4(%rsp),%r14d
mov    %eax,%r14d
jge    11cb <main+0x9b>
cmpl   $0x0,(%rsp)
jle    1170 <main+0x40>
xor    %ebp,%ebp
jmp    11b0 <main+0x80>
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    (%rsp),%ebp
jge    1170 <main+0x40>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x2e,%al
jne    11a0 <main+0x70>
lea    (%rbx,%rbp,1),%eax
test   $0x1,%al
mov    $0x57,%edi
cmove  %r15d,%edi
jmp    11a3 <main+0x73>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
store i32 1, i32* %4
br label %8
8: ; preds = %42, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %45
12: ; preds = %8
store i32 1, i32* %5
br label %13
13: ; preds = %36, %12
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %39
17: ; preds = %13
%18 = call signext i8 (...) @getchar()
store i8 %18, i8* %6
%19 = load i8, i8* %6
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 46
br i1 %21, label %22, label %30
22: ; preds = %17
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = add nsw i32 %23, %24
%26 = srem i32 %25, 2
%27 = icmp ne i32 %26, 0
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 87, i32 66
br label %33
30: ; preds = %17
%31 = load i8, i8* %6
%32 = sext i8 %31 to i32
br label %33
33: ; preds = %30, %22
%34 = phi i32 [ %29, %22 ], [ %32, %30 ]
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %13
39: ; preds = %13
%40 = call signext i8 (...) @getchar()
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %42
42: ; preds = %39
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %8
45: ; preds = %8
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %35, label %8
8: ; preds = %0, %29
%9 = phi i32 [ %32, %29 ], [ 1, %0 ]
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1
br i1 %11, label %29, label %12
12: ; preds = %8, %23
%13 = phi i32 [ %26, %23 ], [ 1, %8 ]
%14 = call signext i8 (...) @getchar()
%15 = icmp eq i8 %14, 46
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = add nuw nsw i32 %13, %9
%18 = and i32 %17, 1
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i32 66, i32 87
br label %23
21: ; preds = %12
%22 = sext i8 %14 to i32
br label %23
23: ; preds = %21, %16
%24 = phi i32 [ %20, %16 ], [ %22, %21 ]
%25 = call i32 @putchar(i32 %24)
%26 = add nuw nsw i32 %13, 1
%27 = load i32, i32* %2
%28 = icmp slt i32 %13, %27
br i1 %28, label %12, label %29
29: ; preds = %23, %8
%30 = call signext i8 (...) @getchar()
%31 = call i32 @putchar(i32 10)
%32 = add nuw nsw i32 %9, 1
%33 = load i32, i32* %1
%34 = icmp slt i32 %9, %33
br i1 %34, label %8, label %35
35: ; preds = %29, %0
ret i32 0
}