Consider a table of size $n \times m$, initially fully white. Rows are numbered $1$ through $n$ from top to bottom, columns $1$ through $m$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square.


-----Input-----

The first line contains two integers $n$ and $m$ ($1 \le n, m \le 115$) — the number of rows and the number of columns in the table.

The $i$-th of the next $n$ lines contains a string of $m$ characters $s_{i1} s_{i2} \ldots s_{im}$ ($s_{ij}$ is 'W' for white cells and 'B' for black cells), describing the $i$-th row of the table.


-----Output-----

Output two integers $r$ and $c$ ($1 \le r \le n$, $1 \le c \le m$) separated by a space — the row and column numbers of the center of the black square.


-----Examples-----
Input
5 6
WWBBBW
WWBBBW
WWBBBW
WWWWWW
WWWWWW

Output
2 4

Input
3 3
WWW
BWW
WWW

Output
2 1

Difficulty: competition

Starter code:

Solutions:
n, m = map(int, input().split())
vert = []
gor = []
for i in range(n):
    s = input()
    for j in range(m):
        if s[j] == 'B':
            vert.append(i)
            gor.append(j)
vert.sort()
gor.sort()
print(vert[len(vert) // 2] + 1, gor[len(gor) // 2] + 1)


import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline

n,m=list(map(int,input().split()))

a=[]
b=[]

for i in range(n):
    s=input().strip()
    for j in range(m):
        if s[j]=='B':
            a.append(i)
            b.append(j)

a.sort()
b.sort()
print((a[0]+a[-1])//2+1,(b[0]+b[-1])//2+1)


n, m = map(int, input().split())
arr = [input() for i in range(n)]
x_c = []
y_c = []
for i in range(n):
	for j in range(m):
		if arr[i][j] == 'B':
			x_c.append(i)
			y_c.append(j)
x_c.sort()
y_c.sort()

print(x_c[len(x_c) // 2] + 1, y_c[len(y_c) // 2] + 1)

n, m = list(map(int, input().split()))
matrix = []
for i in range(n):
    matrix.append(input())
for i in range(n):
    for j in range(m):
        if matrix[i][j] == "B":
            lu = (i, j)
for i in reversed(list(range(n))):
    for j in reversed(list(range(m))):
        if matrix[i][j] == "B":
            rd = (i, j)
print((lu[0] + rd[0]) // 2 + 1, (lu[1] + rd[1]) // 2 + 1)


read = lambda: map(int, input().split())
n, m = read()
a = [input() for i in range(n)]
y1 = x1 = 1e9
y2 = x2 = -1
for i in range(n):
    if 'B' in a[i]:
        y1 = min(y1, i)
        y2 = max(y2, i)
        x1 = a[i].find('B')
        x2 = a[i].rfind('B')
x = (x1 + x2) // 2 + 1
y = (y1 + y2) // 2 + 1
print(y, x)

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

n, m = mi()
g = [input().strip() for i in range(n)]
h = list(zip(*g))

rs = [r for r in range(n) if 'B' in g[r]]
cs = [c for c in range(m) if 'B' in h[c]]
x = (rs[0] + rs[-1]) // 2
y = (cs[0] + cs[-1]) // 2
print(x + 1, y + 1)


r, c = list(map(int, input().split()))

x = -1
mini, maxi = 1e10, -1e10
for y in range(r):
    line = input()

    if "B" in line:
        mini = min(mini, y)
        maxi = max(maxi, y)
        x = (line.find("B") + line.rfind("B")) // 2

y = (mini + maxi) // 2
print(y + 1, x + 1)


#!/usr/bin/env python3
h, w = list(map(int, input().split()))
f = [ input() for y in range(h) ]
ly = 0
while 'B' not in f[ly]:
    ly += 1
ry = ly + 1
while ry < h and 'B' in f[ry]:
    ry += 1
lx = 0
while 'B' != f[ly][lx]:
    lx += 1
rx = lx + 1
while rx < w and 'B' == f[ly][rx]:
    rx += 1
y = (ly + ry) // 2
x = (lx + rx) // 2
print(y + 1, x + 1)


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

LIST=[]
for i in range(n):
    for j in range(m):
        if s[i][j]=="B":
            LIST.append((i+1,j+1))

x=min(LIST)[0]+max(LIST)[0]
y=min(LIST,key=lambda x:x[1])[1]+max(LIST,key=lambda x:x[1])[1]

print(x//2,y//2)


n, m = list(map(int, input().split()))
x = 0
y = 0
k = 0
for i in range(1, n + 1):
    s = input()
    if 'B' in s:
        if k == 0:
            x = i
            y = s.find('B') + 1
        k += 1
print(x + k // 2, y + k // 2)


        


USE_STDIO = False

if not USE_STDIO:
    try: import mypc
    except: pass

def main():
    n, m = list(map(int, input().split(' ')))
    grid = []
    for _ in range(n):
        grid.append(input())
    x0, y0 = n, m
    x1, y1 = 0, 0
    for i in range(n):
        for j in range(m):
            if grid[i][j] == 'B':
                x0 = min(x0, i)
                y0 = min(y0, j)
                x1 = max(x1, i)
                y1 = max(y1, j)
    print((x0+x1)//2+1, (y0+y1)//2+1)

def __starting_point():
    main()




__starting_point()

(n, m) = list(map(int, input().split()))

lst = []
for x in range(n):
    s = input()
    lst.append(s)

x1 = -1
y1 = -1

x2 = -1
y2 = -1

for x in range(n):
    for y in range(m):
        if lst[x][y] == "B" and x1 == -1:
            x1 = x
            y1 = y
        if lst[x][y] == "B":
            x2 = x
            y2 = y

print(x1 + (x2 - x1) // 2 + 1, y1 + (y2 - y1) // 2 + 1)


import math
n, m = list(map(int, input().split()))

mn_x = 1211111
mx_x = -1211111
mn_y = 1211111
mx_y = -1211111

for i in range(n):
    x = input()
    for j in range(len(x)):
        if x[j] == 'B':
            mn_x = min(mn_x, j +1)
            mx_x = max(mx_x, j + 1)
            mn_y = min(mn_y, i + 1)
            mx_y = max(mx_y, i + 1)
print((mx_y + mn_y) // 2, (mx_x + mn_x) // 2)


n, m = map(int, input().split())

for i in range(n):
    s = input()
    if 'B' in s:
        l = s.count('B')
        print(i + l // 2 + 1, s.index('B') + l // 2 + 1)
        break

3

n, m = list(map(int, input().split()))

s = [input() for i in range(n)]
ts = [[s[i][j] for i in range(n)] for j in range(m)]

has_b_row = [i for i in range(n) if 'B' in s[i]]
has_b_column = [j for j in range(m) if 'B' in ts[j]]

print(has_b_row[len(has_b_row) // 2] + 1, has_b_column[len(has_b_column) // 2] + 1)


n, m = map(int, input().split())
for i in range(n):
    row = input()
    if "B" in row:
        left = row.find("B")
        right = row.rfind("B")
        a = right - left + 1
        print(i + a // 2 + 1, left + a // 2 + 1)
        break

3

import math
import sys


def inp():
    return sys.stdin.readline().rstrip()


def solve(N, M, T):
    ax = -1
    ay = -1
    bx = -1
    by = -1

    for y in range(N):
        for x in range(M):
            if T[y][x] == 'B':
                if ax == -1:
                    ax = x
                    ay = y
                bx = x
                by = y

    return ((ay + by) // 2 + 1, (ax + bx) // 2 + 1)


def main():
    N, M = [int(e) for e in inp().split()]
    T = [inp() for _ in range(N)]
    print(*solve(N, M, T))


def __starting_point():
    main()

__starting_point()

n, m = map(int, input().split())
a = [list(input()) for i in range(n)]
start = 0
finish = 0
for i in range(n):
    for j in range(m):
        if a[i][j] == 'B':
            finish = [i, j]
            if start == 0:
                start = finish.copy()
print((start[0] + finish[0]) // 2 + 1, (start[1] + finish[1]) // 2 + 1)

n, m = map(int, input().split())
num = []
for i in range(n):
    num.append(input())
flag = False
for i in range(n):
    if flag:
        break
    for j in range(m):
        if flag:
            break
        fl = False
        if num[i][j] == 'B':
            u1 = j
            fl = True
            for x in range(j, m):
                if num[i][x] == 'B':
                    u2 = x
            if u1 == u2:
                ans1 = i
                ans2 = j
                flag = True
                break
            else:
                raw = (u2 + u1) // 2
                ans2 = raw
                ans1 = i + (u2 - u1) // 2
                flag = True
                break
print(ans1 + 1, ans2 + 1)

n,M=[int(x) for x in input().split()]
m=[]
for i in range(n):
    m.append(input())
c=0
idx=[]
idx2=[]
for i in range(n):
    for j in range(M):
        if m[i][j]=='B':
            idx.append(i)
            idx2.append(j)
            c+=1
ans1=sum(idx)//c+1
ans2=sum(idx2)//c+1
print(ans1,ans2)

import sys
from itertools import permutations

DEBUG = 0
if DEBUG:
    f = open("input.txt", "r")
    input = f.readline
else:
    input = sys.stdin.readline

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

def main():
    INF = int(1e9)
    n, m = mp()
    a = []
    for i in range(n):
        a.append(input().strip())
    imax, imin, jmax, jmin = 0, INF, 0, INF
    for i in range(n):
        for j in range(m):
            if a[i][j] == 'B':
                imax = max(imax, i)
                jmax = max(jmax, j)
                jmin = min(jmin, j)
                imin = min(imin, i)
    print((imax + imin) // 2 + 1, 1 + (jmax + jmin) // 2)
main()

n,m=map(int,input().split())
l=[]
for i in range(n):
	l.append(input())
# print(l)
xstart=-1
ystart=-1
xend=-1
yend=-1
for i in range(n):
	for j in range(m):
		if(l[i][j]=='B' and xstart==-1):
			xstart=j
		if(l[i][j]=='B' and not(xstart==-1)):
			xend=j
		if(l[i][j]=='B' and ystart==-1):
			ystart=i
		if(l[i][j]=='B' and not(ystart==-1)):
			yend=i
print((ystart+yend)//2+1,(xstart+xend)//2 +1)

n,m=map(int,input().split())
a=[]
for i in range(n):
    b=input()
    a.append(b)
cou=0
x=0
y=0
for i in range(n):
    for j in range(m):
        if a[i][j]=='B' and cou==0:
            x=i+1
            y=j+1
            cou+=1
        elif a[i][j]=='B':
            cou+=1
    if cou>0:
        print(x+cou//2,y+cou//2)
        return