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: EASY
Tags: Implementation
Expected Time Complexity: O(N^2)

Starter code:

Solutions:
(n, m) = map(int, input().split())
s = []
for i in range(n):
	s.append(input())
fir = []
yc = -1
for i in range(n):
	for j in range(m):
		if s[i][j] == 'B':
			fir = [i, j]
			break
	if len(fir):
		break
cnt = 0
for i in range(fir[1], m):
	if s[fir[0]][i] == 'B':
		cnt += 1
	else:
		break
finy = fir[1] + cnt // 2
cnt = 0
for i in range(fir[0], n):
	if s[i][fir[1]] == 'B':
		cnt += 1
	else:
		break
finx = fir[0] + cnt // 2
print(finx + 1, finy + 1)


read_numbers = lambda : map(int, input().split())
INF = 1 << 64
(n, m) = read_numbers()
q = [input() for i in range(n)]
for i in range(n):
	if 'B' in q[i]:
		y = i + 1 + q[i].count('B') // 2
		x = q[i].count('B') // 2 + q[i].find('B') + 1
		print(y, x, sep=' ')
		break


n = input().split()
for i in range(int(n[0])):
	s = list(input())
	if 'B' in s:
		print(i + 1 + int(s.count('B') / 2), s.index('B') + 1 + int(s.count('B') / 2), sep=' ')
		break


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


(w, h) = map(int, input().split())
a = []
checki = 0
chi = False
checkj = 0
dl = 0
for i in range(0, w):
	s = input()
	a.append(s)
	if 'B' in s:
		dl += 1
		if not chi:
			checki = i
			chi = True
for j in range(h):
	if a[checki][j] == 'B':
		checkj = j
		break
center1 = dl // 2 + checki + 1
center2 = dl // 2 + checkj + 1
print(center1, center2)


(n, m) = [int(x) for x in input().strip().split(' ')]
matrix = [input().strip() for y in range(n)]
minx = None
miny = None
maxx = None
maxy = None
for i in range(n):
	for j in range(m):
		if matrix[i][j] == 'B':
			if minx == None:
				(minx, maxx) = [i, i]
				(miny, maxy) = [j, j]
			minx = min(minx, i)
			miny = min(miny, j)
			maxx = max(maxx, i)
			maxy = max(maxy, j)
print((minx + maxx) // 2 + 1, (miny + maxy) // 2 + 1)


s = input().split()
n = int(s[0])
m = int(s[1])
r = None
c = None
for i in range(n):
	s = input()
	idx = s.find('B')
	if idx >= 0 and r == None:
		cnt = s.count('B')
		r = i + 1 + cnt // 2
		c = idx + 1 + cnt // 2
print('{} {}'.format(r, c))


(n, m) = list(map(int, input().strip().split()))
(t, b, l, r) = (-1, -1, -1, -1)
for i in range(n):
	line = input()
	for j in range(len(line)):
		if line[j] == 'B':
			if t == -1:
				t = i + 1
			if l == -1:
				l = j + 1
			r = j + 1
			b = i + 1
print((t + b) // 2, (l + r) // 2)


(a, b) = [int(i) for i in input().split()]
k = m = w = 0
for i in range(a):
	w += 1
	l = input()
	m = 0
	for j in l:
		m += 1
		if j == 'B':
			k += 1
		if j == 'W' and k >= 1:
			break
		if m == b:
			m += 1
			break
	if k > 0:
		break
print(w + k // 2, m - k // 2 - 1)


import math

def test(val):
	staX = -1
	endX = -1
	staY = -1
	endY = -1
	for i in range(len(val)):
		for x in range(len(val[i])):
			if val[i][x] == 'B' and staX == -1:
				staX = x + 1
				staY = i + 1
			if val[i][x] == 'B' and staX != -1 and (staY == i + 1):
				endX = x + 1
			if val[i][x] == 'B':
				endY = i + 1
	finY = staY + math.floor((endY + 1 - staY) / 2)
	finX = staX + math.floor((endX + 1 - staX) / 2)
	print(f'{finY} {finX}')
w = []
x = int(input('').split(' ')[0])
for i in range(x):
	w.append(input(''))
test(w)


(n, m) = [int(x) for x in input().strip().split()]
row = -1
colm = -1
start_row = -1
lastx = False
for _ in range(n):
	l = input()
	if 'B' in l and (not lastx):
		start_row = _
		lastx = True
	if 'B' not in l and lastx:
		row = (_ + start_row) // 2 + 1
		lastx = False
	lastB = False
	for i in range(m):
		if l[i] == 'B' and (not lastB):
			col = i
			lastB = True
		if l[i] == 'W' and lastB:
			colm = (i + col) // 2 + 1
			lastB = False
if colm == -1:
	colm = (m + col) // 2 + 1
if row == -1:
	row = (n + start_row) // 2 + 1
print(row, colm)


(n, m) = map(int, input().split())
matr = []
ma = []
for i in range(n):
	matr.append(input())
for i in range(n):
	for j in range(m):
		if matr[i][j] == 'B':
			ma.append([i, j])
(maxi, maxj, mini, minj) = (-1, -1, 116, 116)
if len(ma) == 1:
	print(ma[0][0] + 1, ma[0][1] + 1)
	exit()
for i in range(len(ma)):
	maxi = max(maxi, ma[i][0])
	mini = min(mini, ma[i][0])
	maxj = max(maxj, ma[i][1])
	minj = min(minj, ma[i][1])
print((maxi + mini) // 2 + 1, (minj + maxj) // 2 + 1)


import sys

def main():
	input = sys.stdin
	dimensions = list(map(int, input.readline().rstrip('\n').split(' ')))
	minRow = dimensions[0] + 1
	minCol = dimensions[1] + 1
	maxRow = -1
	maxCol = -1
	for i in range(0, dimensions[0]):
		line = input.readline()
		for j in range(0, dimensions[1]):
			if line[j] == 'B':
				minRow = min(i, minRow)
				minCol = min(j, minCol)
				maxRow = max(i, maxRow)
				maxCol = max(j, maxCol)
	print(int((minRow + maxRow) / 2) + 1, int((minCol + maxCol) / 2) + 1)
main()


s = input().split(' ')
n = int(s[0])
m = int(s[1])

def main(n, m):
	st = -1
	end = -1
	for i in range(n):
		row = input()
		ind = row.find('B')
		if ind != -1:
			if st == -1:
				st = [i, ind]
			else:
				ind = row[::-1].find('B')
				end = [i, m - ind - 1]
	if st != -1:
		if end == -1:
			return st
		else:
			x = st[0] + (end[0] - st[0]) / 2
			y = st[1] + (end[1] - st[1]) / 2
			return [int(x), int(y)]
	else:
		return [-2, -2]
res = main(n, m)
print('{} {}'.format(res[0] + 1, res[1] + 1))


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	s = input()
	arr.append(s)
start_r = -1
start_c = -1
end_r = -1
end_c = -1
start_c1 = -1
start_r1 = -1
end_r1 = -1
end_c1 = -1
for i in range(n):
	for j in range(m):
		if arr[i][j] == 'B' and start_r == -1 and (start_c == -1):
			start_r = i + 1
			start_c = j + 1
		if arr[i][j] == 'B':
			start_r1 = i + 1
			start_c1 = j + 1
print((start_r1 + start_r) // 2, (start_c1 + start_c) // 2)


(n, m) = map(int, input().split())
a = [0] * n
for i in range(n):
	a[i] = input()
(start, end) = (-1, -1)
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B' and start == -1:
			(start, end) = ((i, j), (i, j))
		if start != -1 and a[i][j] == 'B':
			end = (i, j)
print(1 + (end[0] + start[0]) // 2, 1 + (end[1] + start[1]) // 2)


def get_data(NN):
	out = []
	for i in range(int(NN[0])):
		out.append(input())
	return out
NN = input().split(' ')
data = get_data(NN)
n = 0
first = 0
for st in data:
	new = True
	for (i, sumb) in enumerate(st):
		if sumb == 'B':
			n = n + 1
			if new:
				new = False
				first = i + 1
	if not new:
		break
first = int(first + (n - 1) / 2)
sec = 0
n = 0
new = True
for (i, st) in enumerate(data):
	if 'B' in st:
		n = n + 1
		if new:
			new = False
			sec = i + 1
sec = int(sec + (n - 1) / 2)
print(' '.join((str(sec), str(first))))


(n, m) = [int(s) for s in input().split(' ')]
arr = []
length = 0
x = 0
y = 0
count = 0
flag = 0
for i in range(n):
	s = input()
	length = len(s)
	arr.append(s)
for i in range(n):
	for j in range(len(arr[i])):
		if arr[i][j] == 'B':
			x = i
			y = j
			flag = 1
			break
	if flag == 1:
		break
while True:
	if arr[x][j] == 'B':
		count += 1
	if arr[x][j] != 'B':
		break
	if j == len(arr[0]) - 1:
		break
	j += 1
print('{} {}'.format(int(x + 1 + count / 2), int(y + 1 + count / 2)))


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


x = input('')
r = int(x.split()[0])
c = int(x.split()[1])
li = list()
for i in range(r):
	t = input('')
	li.append(t)
first = 1
for r in range(r):
	if 'B' in li[r]:
		if first == 1:
			first = 0
			fr = r
			lr = r
			fc = li[r].find('B')
			lc = li[r].rfind('B')
		else:
			lr = r
print(int((fr + lr) / 2) + 1, int((fc + lc) / 2) + 1)


import math
(n, m) = map(int, input().split(' '))
first_point = (0, 0)
square_len = 0
found = False
for row in range(0, n):
	line = input()
	if not found:
		prev_char = ''
		for col in range(0, m):
			curr_char = line[col]
			if curr_char == 'B':
				square_len += 1
				if prev_char == 'W' or prev_char == '':
					first_point = (row, col)
				found = True
			prev_char = curr_char
center_distance = math.ceil(square_len / 2) - 1
print(first_point[0] + center_distance + 1, first_point[1] + center_distance + 1)


(n, m) = map(int, input().split())
grid = []
for i in range(n):
	grid.append(list(input()))

def getlr(grid, n):
	for i in range(n):
		if 'B' in grid[i]:
			(l, r) = (grid[i].index('B'), len(grid[i]) - grid[i][::-1].index('B') - 1)
			return (l, r)
(l, r) = getlr(grid, n)
(t, d) = getlr(list(zip(*grid)), m)
(x, y) = ((t + d) // 2, (l + r) // 2)
print('%d %d' % (x + 1, y + 1))


(n, m) = list(map(int, input().split()))
arr = []
for _ in range(n):
	arr.append(list(input()))
(r, c) = [1, 1]
for (index, i) in enumerate(arr):
	if 'B' in i:
		r = index + 1
		for (index2, j) in enumerate(i):
			if j == 'B':
				c = index2 + 1
				break
		break
side = len([i for i in arr if 'B' in i])
print(f'{r + int(side / 2)} {c + int(side / 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)


import sys
lines = sys.stdin.readlines()
[n, m] = lines[0].split(' ')
for (index, line) in enumerate(lines[1:]):
	b_start = line.find('B')
	if b_start != -1:
		length = line.count('B')
		print(index + 1 + length // 2, ' ', b_start + 1 + length // 2)
		break


(n, m) = map(int, input().split())
i = 0
i_begin = -1
i_end = -1
while i < n:
	i += 1
	s = input()
	k = s.find('B')
	if i_begin == -1 and k != -1:
		i_begin = i
		j = k + 1
		while j < len(s) and s[j] == 'B':
			j += 1
		j_center = (j - k) // 2 + k + 1
	elif i_begin != -1 and k == -1:
		i_end = i
		break
if i_end == -1:
	i_end = n + 1
i_center = (i_end - i_begin) // 2 + i_begin
print(i_center, j_center)


(n, m) = map(int, input().split())
for i in range(n):
	x = input()
	if x.count('B') != 0:
		print(x.count('B') // 2 + i + 1, x.count('B') // 2 + x.index('B') + 1)
		break


def solution(l1):
	i = 0
	while i < len(l1):
		if 'B' in l1[i]:
			start = [i + 1, l1[i].index('B') + 1]
			break
		i += 1
	i = len(l1) - 1
	while i >= 0:
		if 'B' in l1[i]:
			l1[i] = list(l1[i])
			l1[i].reverse()
			s = len(l1[i]) - l1[i].index('B')
			finish = [i + 1, len(l1[i]) - l1[i].index('B')]
			break
		i -= 1
	place = str(int((start[0] + finish[0]) / 2)) + ' ' + str(int((start[1] + finish[1]) / 2))
	return place

def answer():
	a = [int(x) for x in input().split()]
	l1 = []
	while a[0]:
		l1.append(input())
		a[0] -= 1
	print(solution(l1))
answer()


(n, m) = [int(i) for i in input().split()]
arr = []
for i in range(n):
	x = input().strip()
	arr.append(x)
for i in range(n):
	for j in range(m):
		if arr[i][j] == 'B':
			x1 = i + 1
			x2 = j + 1
			break
for i in range(n - 1, -1, -1):
	for j in range(m - 1, -1, -1):
		if arr[i][j] == 'B':
			y1 = i + 1
			y2 = j + 1
			break
print((x1 + y1) // 2, (x2 + y2) // 2)


f = 1
d = 0
n = []
for i in range(1, int(input().split()[0]) + 1):
	b = input()
	if 'B' in b:
		d = b.count('B')
		f = b.index('B' * d) + 1
		n = n + [i]
print(n[len(n) // 2], f + d // 2)


def mi():
	return map(int, input().split())
(n, m) = mi()
a = [0] * n
for i in range(n):
	a[i] = list(input())
start = -1
end = -1
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B' and start == -1:
			start = (i, j)
			end = (i, j)
		if start != -1 and a[i][j] == 'B':
			end = (i, j)
print(1 + (end[0] + start[0]) // 2, 1 + (end[1] + start[1]) // 2)


(n, m) = map(int, input().split())
a = [''] * n
for i in range(n):
	a[i] = input()
x = y = 1
for i in range(n):
	s = a[i]
	p = s.find('B')
	if p != -1:
		e = s[::-1].find('B')
		l = (m - p - e + 3) // 2
		(x, y) = (i + l - 1, p + l - 1)
		break
print(x, y)


(n, m) = map(int, input().split())
(maxa, ind) = (-1, -1)
(st, en) = (-1, -1)
(row, col) = (-1, -1)
for i in range(n):
	s = input()
	st = s.find('B')
	en = s.rfind('B')
	if en != -1 and st != -1:
		ind = en - st + 1
		if maxa < ind:
			maxa = ind
			row = i
			col = st
print(row + maxa // 2 + 1, col + maxa // 2 + 1)


(n, m) = map(int, input().split())
c = d = z = 0
for i in range(n):
	s = input()
	if 'B' in s:
		z += 1
		c = i + 1
		if d == 0:
			d = s.index('B') + 1
print(c - z // 2, d + z // 2)


(n, _) = map(int, input().split())
A = [input() for _ in range(n)]
for col in zip(*A):
	if 'B' in col:
		col = ''.join(col)
		print(1 + (col.find('B') + col.rfind('B')) // 2, end=' ')
		break
for row in A:
	if 'B' in row:
		print(1 + (row.find('B') + row.rfind('B')) // 2)
		break


(n, m) = map(int, input().strip().split())
c = 0
l = []
idx = []
cnt = 0
for i in range(n):
	l.append(input())
for i in range(n):
	if 'B' in l[i] and cnt == 0:
		cnt += 1
		for j in range(len(l[i])):
			if l[i][j] == 'B':
				c += 1
			if c == 1 and l[i][j] == 'B':
				idx.append(i)
				idx.append(j)
if c == 1:
	print(idx[0] + 1, idx[1] + 1)
else:
	print(idx[0] + c // 2 + 1, idx[1] + c // 2 + 1)


import math
import os
import random
import re
import sys

def findsquare(arr, n, m):
	minp = [-1, -1]
	maxp = [-1, -1]
	for x in range(n):
		for y in range(m):
			if arr[x][y] == 'B':
				if minp == [-1, -1]:
					minp = [x + 1, y + 1]
				else:
					maxp = [x + 1, y + 1]
	if maxp == [-1, -1]:
		maxp = minp
	return (int((minp[0] + maxp[0]) / 2), int((minp[1] + maxp[1]) / 2))
(n, m) = list(map(int, input().split()))
arr = []
for _ in range(n):
	arr.append([ele for ele in input()])
print(' '.join(list(map(str, findsquare(arr, n, m)))))


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


(z, c) = map(int, input().split())
e = []
a = []
number = 1
for i in range(z):
	m = list(input())
	a.append(m)
for i in range(len(a)):
	for j in range(len(a[i])):
		if a[i][j] == 'B':
			a[i][j] = number
			number += 1
number = number // 2
for i in range(len(a)):
	for j in range(len(a[i])):
		if a[i][j] == number:
			red = i
			kolona = j
			break
print(red + 1, kolona + 1)


(n, m) = map(int, input().split())
l = []
for i in range(n):
	l.append(list(input()))
for i in range(m):
	if l[0][i] == 'W':
		l[0][i] = 0
	else:
		l[0][i] = 1
for i in range(1, n):
	if l[i][0] == 'W':
		l[i][0] = 0
	else:
		l[i][0] = 1
oddmax = [0, 0, 0]
for i in range(1, n):
	for j in range(1, m):
		if l[i][j] == 'B':
			l[i][j] = 1
		else:
			l[i][j] = 0
		if l[i][j - 1] is not 0 and l[i - 1][j] is not 0 and (l[i - 1][j - 1] is not 0) and (l[i][j] is not 0):
			l[i][j] = l[i - 1][j - 1] + 1
		oddmax = [l[i][j], i, j] if l[i][j] > oddmax[0] and l[i][j] % 2 is 1 else oddmax
if oddmax[0] == oddmax[1] == oddmax[2] == 0:
	if 1 not in l[0]:
		o = 0
		for i in range(1, n):
			if l[i][0] == 1:
				o = i
				break
		print(o + 1, 1)
	else:
		print(1, l[0].index(1) + 1)
else:
	print(oddmax[1] + 1 - oddmax[0] // 2, oddmax[2] + 1 - oddmax[0] // 2)


(n, m) = map(int, input().split())
r = 0
c = 0
f = 1
for i in range(n):
	s = input()
	if f and 'B' in s:
		f = 0
		ci = s.index('B')
		cc = s.count('B')
		r = i + 1 + cc // 2
		c = ci + cc // 2 + 1
print(r, c)


(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	j = s.find('B')
	if j >= 0:
		break
c = s.count('B') // 2 + 1
print(i + c, j + c)


[n, m] = [int(x) for x in input().split()]
L = []
I = []
s = 0
for i in range(n):
	r = input()
	L.append(r)
	if 'B' in r:
		s += 1
		I.append(i)
print(min(I) + len(I) // 2 + 1, L[min(I)].index('B') + len(I) // 2 + 1)


(n, m) = [int(i) for i in input().split()]
a = [[] for i in range(n)]
(x1, x2, y1, y2) = (-1, -1, -1, -1)
for i in range(n):
	s = input()
	a[i].append(s)
	if s.find('B') != -1 and x1 == -1 and (x2 == -1) and (y1 == -1):
		x1 = s.find('B') + 1
		x2 = s.rfind('B') + 1
		y1 = i + 1
		y2 = i + 1
	elif s.find('B') != -1:
		y2 = i + 1
print((y2 + y1 + 1) // 2, (x1 + x2 + 1) // 2)


(n, m) = map(int, input().split())
sq = []
for i in range(n):
	sq.append(list(input()))
i = 0
j = 0
while i < n:
	j = 0
	while j < m:
		if sq[i][j] == 'B':
			break
		else:
			j += 1
	if j < m and sq[i][j] == 'B':
		break
	i += 1
b = j
while b < m and sq[i][b] == 'B':
	b += 1
delta = (b - j) // 2 + 1
print(i + delta, j + delta)


num = input().split(' ')
n = int(num[0])
m = int(num[1])
table = list()
for i in range(n):
	table.append(input())
for i in range(n):
	flag = True
	for j in range(len(table[i])):
		if table[i][j] == 'B':
			row = i
			col = j
			while col + 2 < m and row + 2 < n and (table[i][col + 2] == 'B') and (table[row + 2][j] == 'B'):
				col += 2
				row += 2
			if row == i:
				x = i
				y = j
			else:
				x = i + (row - i + 1) / 2
				y = j + (col - j + 1) / 2
			print(int(x + 1), ' ', int(y + 1))
			flag = False
			break
	if not flag:
		break


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


(n, m) = map(int, input().split())
matrix = []
for i in range(n):
	row = list(str(input()))
	matrix.append(row)
for j in range(n):
	for k in range(m):
		if matrix[j][k] == 'B':
			c = j
			d = k
for p in reversed(range(n)):
	for q in reversed(range(m)):
		if matrix[p][q] == 'B':
			f = p
			g = q
r = int((c + f) / 2)
s = int((d + g) / 2)
print(r + 1, ' ', s + 1)


n = int(input().split()[0])
i = j = -1
while j < 0:
	s = input()
	j = s.find('B')
	i += 1
c = s.count('B') // 2 + 1
print(i + c, j + c)


(n, m) = [int(x) for x in input().split()]
coords = []
for i in range(n):
	for (j, c) in enumerate(input()):
		if c == 'B':
			coords.append((i, j))
i = (min((x[0] for x in coords)) + max((x[0] for x in coords))) // 2
j = (min((x[1] for x in coords)) + max((x[1] for x in coords))) // 2
print(i + 1, j + 1)


(n, m) = map(int, input().split())
s = [input() for i in range(n)]
cc = rr = 1
for row in range(n):
	col = s[row].find('B')
	if col >= 0:
		c = col + 1
		while c < m and s[row][c] == 'B':
			c += 1
		r = row + 1
		while r < n and s[r][c - 1] == 'B':
			r += 1
		rr = (r - row) // 2 + 1 + row if r - row > 1 else row + 1
		cc = (c - col) // 2 + 1 + col if c - col > 1 else col + 1
		break
print(rr, cc)


(a, b) = input().split()
a = int(a)
b = int(b)
x = []
for i in range(a):
	x.append(list(input().strip()))
start = []
end = []
flag = 0
for i in range(len(x) - 1, -1, -1):
	for j in range(len(x[0]) - 1, -1, -1):
		if x[i][j] == 'B':
			end.append(i + 1)
			end.append(j + 1)
			flag = 1
			break
		if flag == 1:
			break
flag = 0
for i in range(len(x)):
	for j in range(len(x[0])):
		if x[i][j] == 'B':
			start.append(i + 1)
			start.append(j + 1)
			flag = 1
			break
		if flag == 1:
			break
a = (start[0] + end[0]) // 2
b = (start[1] + end[1]) // 2
print(str(a) + ' ' + str(b))


st = input()
n = int(st.split()[0])
m = int(st.split()[1])
flag1 = True
flag2 = False
for j in range(n):
	st = input()
	i = 0
	for letter in st:
		i += 1
		if letter == 'B':
			if flag2:
				if j == y:
					l += 1
			if flag1:
				x = i
				y = j
				flag1 = False
				flag2 = True
				l = 1
print(y + 1 + l // 2, end=' ')
print(x + l // 2)


(n, m) = map(int, input().split())
mij = [input() for i in range(n)]
r_min = n
r_max = 0
c_min = m
c_max = 0
for i in range(n):
	for j in range(m):
		if mij[i][j] == 'B':
			r_min = min(r_min, i)
			c_min = min(c_min, j)
			r_max = max(r_max, i)
			c_max = max(c_max, j)
print((r_min + r_max) // 2 + 1, (c_min + c_max) // 2 + 1)


sizes = input().split()
list1 = []
for i in range(int(sizes[0])):
	list1.append(list(input()))
k = 0
s = 0
n = 0
for i in list1:
	if 'B' in i:
		k = int((i.index('B') + (int(sizes[1]) - i[::-1].index('B') - 1)) / 2)
		break
for i in range(int(sizes[0])):
	if 'B' in list1[i]:
		s += i
		n += 1
print(int(s / n) + 1, '', k + 1)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

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

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

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

def S():
	return input()

def main():
	(h, w) = LI()
	field = [S() for _ in range(h)]
	sm = 0
	for x in field:
		sm += x.count('B')
	if sm == 1:
		for i in range(h):
			for j in range(w):
				if field[i][j] == 'B':
					return str(i + 1) + ' ' + str(j + 1)
	sm = int(math.sqrt(sm))
	sm -= 1
	sm //= 2
	for i in range(h):
		for j in range(w):
			a = i + sm
			b = j + sm
			c = i - sm
			d = j - sm
			if 0 <= a < h and 0 <= b < w and (0 <= c < h) and (0 <= d < w):
				if field[a][j] == 'B' and field[c][j] == 'B' and (field[i][b] == 'B') and (field[i][d] == 'B'):
					return str(i + 1) + ' ' + str(j + 1)
print(main())


(n, k) = map(int, input().split())
l = []
for i in range(n):
	w = list(input())
	l.append(w)
r = []
for i in range(n):
	for j in range(k):
		if l[i][j] == 'B':
			r.append([i, j])
w = len(r)
s = int(w / 2)
p = r[s]
for i in range(2):
	print(p[i] + 1, end=' ')


(n, m) = map(int, input().split())
a = [list(input()) for _ in range(n)]
result = []
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B':
			result.append((i + 1, j + 1))
print(' '.join(map(str, result[len(result) // 2])))


(n, m) = map(int, input().split())
f = True
begin1 = (0, 0)
begin2 = (0, 0)
end1 = (0, 0)
end2 = (0, 0)
last_st = input()
if f and 'B' in last_st:
	begin1 = (1, last_st.index('B') + 1)
	st1 = last_st[::-1]
	begin2 = (1, m - st1.index('B'))
	f = False
for i in range(1, n):
	st = input()
	if f and 'B' in st:
		begin1 = (i + 1, st.index('B') + 1)
		st1 = st[::-1]
		begin2 = (i + 1, m - st1.index('B'))
		f = False
	if not f and 'B' not in st and ('B' in last_st):
		end1 = (i, last_st.index('B') + 1)
		last_st1 = last_st[::-1]
		end2 = (i, m - last_st1.index('B'))
	last_st = st
if sum(end1) == 0:
	end1 = (n, last_st.index('B'))
print((begin1[0] + end1[0]) // 2, (begin1[1] + begin2[1]) // 2)


(n, m) = [int(i) for i in input().split()]
r = 0
c = 0
solved = False
for i in range(n):
	row = [char for char in input()]
	if not solved:
		b_count = row.count('B')
		if b_count > 0:
			solved = True
			col_start = row.index('B')
			row_start = i
			r = row_start + b_count // 2 + 1
			c = col_start + b_count // 2 + 1
print(r, c)


read = lambda : map(int, input().split())
(n, m) = read()
a = [input() for i in range(n)]
y1 = x1 = 1000000000.0
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)


(n, m) = map(int, input().split())
a = ['' for i in range(n)]
(x1, y1) = (0, 0)
(x2, y2) = (-1, -1)
flag = True
for i in range(n):
	s = input()
	if flag:
		for (j, v) in enumerate(s):
			if v == 'B' and flag:
				x1 = i
				y1 = j
				flag = False
	else:
		for (j, v) in enumerate(s):
			if v == 'B':
				x2 = i
				y2 = j
if x2 == -1:
	x2 = x1
	y2 = y1
print((x1 + x2 + 2) // 2, (y1 + y2 + 2) // 2)


(h, w) = 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)


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
(n, m) = q()
a = [input() for _ in range(n)]
x = 0
c = 0
for i in range(n):
	if 'B' in a[i]:
		x += i
		c += 1
print(x // c + 1, end='')
(x, c) = (0, 0)
for i in range(m):
	if 'B' in [*zip(*a)][i]:
		x += i
		c += 1
print('', x // c + 1)


(n, k) = map(int, input().split())
a = []
for i in range(n):
	b = list(input())
	a.append(b)
l = []
for i in range(n):
	for j in range(k):
		if a[i][j] == 'B':
			l.append([i, j])
b = len(l)
x = int(b / 2)
y = l[x]
for i in range(2):
	print(y[i] + 1, end=' ')


(r, c) = list(map(int, input().split()))
ff = []
l = 0
z = 1
a = []
ka = 0
for x in range(r):
	lk = input()
	ff.append(lk)
	if 'B' in lk and ka == 0:
		a.append(l)
		z = 0
		ka += 1
	elif 'B' not in lk:
		if z == 0:
			a.append(l - 1)
			z = 1
		else:
			pass
	l += 1
if len(a) == 1:
	a.append(len(ff) - 1)
if len(a) == 2:
	fd = int((a[1] + a[0]) / 2)
	td = list(ff[a[0]])
	kod = td.index('B')
	sam = (a[1] - a[0] + 1) // 2 + 1
	laam = int(sam)
	print(fd + 1, kod + laam)


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	arr.append(input())
begin_raw = end_raw = int
for i in range(n):
	if 'B' in arr[i]:
		begin_raw = i
		break
for i in range(n):
	if 'B' in arr[::-1][i]:
		end_raw = n - i
		break
begin_col = end_col = int
for j in range(m):
	for i in range(n):
		if arr[i][j] == 'B':
			begin_col = j
			break
for j in range(m - 1, -1, -1):
	for i in range(n):
		if arr[i][j] == 'B':
			end_col = j
			break
print((begin_raw + end_raw) // 2 + 1, (begin_col + end_col) // 2 + 1)


(m, n) = map(int, input().split())
arr = []
A = []
for i in range(m):
	k = list(input())
	A.append(k)
l = [(i, j) for i in range(0, m) for j in range(0, n) if A[i][j] == 'B']
print(l[len(l) // 2][0] + 1, l[len(l) // 2][1] + 1)


(n, m) = [int(x) for x in input().split()]
(min_left, min_rite) = (120, 120)
found = False
for i in range(n):
	if found:
		input()
	else:
		s = input()
		if 'B' in s:
			(x1, y1) = (i, s.find('B'))
			(x2, y2) = (i, s.rfind('B'))
			length = y2 - y1 + 1
			midx = x1 + length // 2 + 1
			midy = y1 + length // 2 + 1
			print(midx, midy)
			found = True


def main():
	(n, m) = map(int, input().split())
	a = b = (-1, -1)
	for i in range(n):
		string = input()
		try:
			idx = string.index('B')
		except ValueError:
			idx = -1
		try:
			ridx = string.rindex('B')
		except ValueError:
			ridx = -1
		if idx != -1 and a[0] == -1:
			a = (i, idx)
		if ridx != -1:
			b = (i, ridx)
	print(str(1 + (a[0] + b[0]) // 2) + ' ' + str(1 + (a[1] + b[1]) // 2))
main()


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
c1 = []
c2 = []
for i in range(len(a)):
	if 'B' in a[i]:
		c1.append(i + 1)
for i in range(len(a[c1[0] - 1])):
	if a[c1[0] - 1][i] == 'B':
		c2.append(i + 1)
print(c1[len(c1) // 2], c2[len(c2) // 2])


(n, m) = input().split(' ')
n = int(n)
m = int(m)
grid = []
for i in range(n):
	s = input()
	grid.append(s)
x = 0
y = 0
ln = 0
found = False
for row in range(n):
	if found:
		break
	for col in range(m):
		if grid[row][col] == 'B':
			x = row
			y = col
			while grid[row][col] == 'B' and col < m - 1:
				col += 1
				ln += 1
			found = True
			break
print(x + int(ln / 2) + 1, y + int(ln / 2) + 1)


(n, m) = [int(z) for z in input().split()]
sq = [[z for z in input()] for line in range(n)]
side = 0
x = 0
y = 0
flag = True
for i in range(n):
	for j in range(m):
		if sq[i][j] == 'B':
			if flag:
				x = i + 1
				y = j + 1
				flag = False
			side += 1
	if not flag:
		break
print(x + side // 2, y + side // 2)


def procura(matriz):
	contadorAltura = 0
	for i in matriz:
		for j in i:
			if j == 'B':
				contadorAltura += 1
				break
	contadorLargura = 0
	aux = True
	for i in matriz:
		for j in i:
			if j == 'B':
				aux = False
				contadorLargura += 1
		if not aux:
			break
	for i in range(len(matriz)):
		for j in range(len(matriz[i])):
			if matriz[i][j] == 'B':
				return [i + contadorAltura // 2, j + contadorLargura // 2]
(altura, largura) = map(int, input().split())
matriz = []
for i in range(altura):
	matriz.append(input())
saida = procura(matriz)
print(saida[0] + 1, saida[1] + 1)


(a, b) = map(int, input().split())
d = []
for i in range(0, a):
	s = str(input())
	d.append([])
	for t in s:
		d[i].append(t)
m2 = 0
m1 = 0
for i in range(0, len(d)):
	t = 0
	low = 0
	while t == 0 and low < len(d[0]):
		if d[i][low] == 'W':
			low += 1
		else:
			t = 1
	up = len(d[i]) - 1
	t = 0
	while t == 0 and up >= 0:
		if d[i][up] == 'W':
			up -= 1
		else:
			t = 1
	if t == 1:
		m2 = (low + up) / 2 + 1
for i in range(0, len(d[0])):
	t = 0
	low = 0
	while t == 0 and low < len(d):
		if d[low][i] == 'W':
			low += 1
		else:
			t = 1
	up = len(d) - 1
	t = 0
	while t == 0 and up >= 0:
		if d[up][i] == 'W':
			up -= 1
		else:
			t = 1
	if t == 1:
		m1 = (low + up) / 2 + 1
print(int(m1), int(m2))


def count():
	(n, m) = list(map(int, input().split()))
	matrix = []
	for i in range(1, n + 1):
		matrix.append(list(map(str, input().split())))
	count = 0
	for i in range(0, n):
		for j in range(0, m):
			if matrix[i][0][j] == 'B':
				while j < m and matrix[i][0][j] == 'B':
					count += 1
					j += 1
				col = j - count // 2
				row = i + 1 + count // 2
				print(row, col)
				return
count()


(n, m) = map(int, input().split())
temp = []
for i in range(n):
	temp.append(input())
a = []
b = []
for i in range(n):
	for j in range(m):
		if temp[i][j] == 'B':
			a.append(i)
			b.append(j)
v = int((max(a) + min(a)) / 2) + 1
w = int((max(b) + min(b)) / 2) + 1
print(str(v) + ' ' + str(w))


(n, m) = map(int, input().split())
l = []
for i in range(n):
	l1 = input()
	l.append(l1)
for i in range(n):
	if 'B' in l[i]:
		a = l[i].count('B')
		j = l[i].index('B')
		print(str(i + 1 + a // 2) + ' ' + str(j + 1 + a // 2))
		break


(n, m) = input().split()
i = j = -1
while j < 0:
	mat = input()
	j = mat.find('B')
	i += 1
	c = mat.count('B') // 2 + 1
print(i + c, j + c)


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)


(r, c) = [int(i) for i in input().split()]
a = []
for i in range(r):
	s = input()
	b = []
	for j in s:
		b.append(j)
	a.append(b)
t = 0
for i in range(r):
	for j in range(c):
		if a[i][j] == 'B':
			(kr, kc) = (0, 0)
			f = j
			while a[i][f] == 'B' and f < c - 1:
				f += 1
				kr += 1
			f = i
			while a[f][j] == 'B' and f < r - 1:
				kc += 1
				f += 1
			print(i + kr // 2 + 1, j + kc // 2 + 1)
			break
	if a[i][j] == 'B':
		break


(n, m) = map(int, input().split())
lis = []
temp = 0
temp1 = 0
r1 = 0
r2 = 0
for i in range(n):
	s = input()
	lis.append(s)
for i in range(n):
	if lis[i].find('B') != -1:
		temp = i
		break
i = n - 1
while i >= 0:
	if lis[i].find('B') != -1:
		temp1 = i
		break
	i -= 1
for i in range(n):
	if lis[i].find('B') != -1:
		r1 = lis[i].find('B')
		r2 = lis[i].rfind('B')
		break
print((temp1 + temp) // 2 + 1, (r1 + r2) // 2 + 1)


import sys
input = sys.stdin.readline
(r, c) = map(int, input().split())
for i in range(r):
	s = input()
	if s.count('B') > 0:
		col = s.index('B')
		print(i + s.count('B') // 2 + 1, col + s.count('B') // 2 + 1)
		break


from math import ceil
(r, c) = list(map(int, input().strip().split()))
squre = []
black = []
rw = 0
for i in range(r):
	string = input()
	squre.append(string)
for word in squre:
	if 'B' in word:
		black.append(word)
for (index, word) in enumerate(squre):
	if 'B' in word:
		rw = index
		break
start = black[0].find('B')
end = black[0].rfind('B')
raw = ceil(len(black) / 2) + rw
col = ceil(end - start) / 2 + start + 1
print(str(raw) + ' ' + str(int(col)))


(n, m) = map(int, input().split())
l = []
l1 = []
for i in range(n):
	a = input()
	l.append(a)
for i in range(n):
	flag = 0
	for j in range(m):
		if l[i][j] == 'B':
			flag = 1
			break
	if flag == 1:
		l1.append(i + 1)
b = (l1[0] + l1[-1]) // 2
l1 = []
for i in range(m):
	if l[b - 1][i] == 'B':
		l1.append(i + 1)
c = (l1[0] + l1[-1]) // 2
print(b, c)


(r, c) = map(int, input().split())
k = []
for i in range(r):
	s = input()
	k.append(s)
rf = None
rl = None
cf = None
cl = None
for i in range(r):
	if 'B' in k[i]:
		if rf == None:
			rf = i + 1
		rl = i + 1
for i in range(r):
	if 'B' in k[i]:
		for j in range(c):
			if k[i][j] == 'B':
				if cf == None:
					cf = j + 1
				cl = j + 1
		break
print(rf + (rl - rf) // 2, cf + (cl - cf) // 2)


(a, b) = map(int, input().split())
(l, c, m) = ([], [], [])
for x in range(a):
	d = input()
	c.append(d)
	if 'B' in d:
		l.append(x)
e = c[l[len(l) // 2]]
for x in range(b):
	if e[x] == 'B':
		m.append(x)
print(l[len(l) // 2] + 1, m[len(m) // 2] + 1)


(n, m) = 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) = [int(i) for i in input().split(' ')]
l = []
for i in range(n):
	l.append([i for i in input()])
(rs, cs) = ([], [])
for i in range(n):
	if 'B' in l[i]:
		rs.append(i)
for i in range(m):
	for j in range(n):
		if l[j][i] == 'B':
			cs.append(i)
print(1 + rs[0] + (rs[-1] - rs[0]) // 2, 1 + cs[0] + (cs[-1] - cs[0]) // 2)


(n, m) = map(int, input().split())
for i in range(n):
	a = input()
	if a.count('B') > 0:
		print(i + a.count('B') // 2 + 1, a.find('B') + a.count('B') // 2 + 1)
		break


import sys
(l, c) = map(int, sys.stdin.readline().split())
for loop in range(l):
	ligne = sys.stdin.readline()
	debut = -1
	taille = 0
	for i in range(c):
		if ligne[i] == 'B':
			if debut == -1:
				debut = i
			taille += 1
	if debut != -1:
		print(loop + (taille + 1) // 2, debut + (taille + 1) // 2)
		break


(N, M) = map(int, input().split())
aMin = (1000, 1000)
aMax = (-1, -1)
for r in range(N):
	s = input()
	for c in range(M):
		if s[c] == 'B':
			v = (r, c)
			aMin = min(aMin, v)
			aMax = max(aMax, v)
print((aMin[0] + aMax[0]) // 2 + 1, (aMin[1] + aMax[1]) // 2 + 1)


(n, m) = map(int, input().split())
v = False
for i in range(n):
	row = input()
	if not v and 'B' in row:
		(s, e) = (row.find('B'), row.rfind('B'))
		c = (s + e) // 2
		r = i + c - s
		v = True
print(r + 1, c + 1)


(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	if 'B' in s:
		l = s.index('B')
		r = s.rindex('B')
		a = (r - l) // 2 + 1
		print(i + a, l + a)
		raise SystemExit


import sys
line1 = str(sys.stdin.readline())
n = int(line1.split(' ')[0])
m = int(line1.split(' ')[1])
table = []
for i in range(n):
	table.append(str(sys.stdin.readline()).rstrip())
x1 = -1
y1 = -1
x2 = -1
y2 = -1

def findstart():
	for i in range(m):
		for j in range(n):
			if table[j][i] == 'B':
				x1 = i
				y1 = j
				return (x1, y1)
	return (-1, -1)
(x1, y1) = findstart()

def findend():
	for i in range(m - 1, -1, -1):
		for j in range(n - 1, -1, -1):
			if table[j][i] == 'B':
				x = i
				y = j
				return (x, y)
	return (-1, -1)
(x2, y2) = findend()
print(str(str(int((y2 - y1) / 2) + y1 + 1) + ' ' + str(int((x2 - x1) / 2) + x1 + 1)))


(n, m) = map(int, input().split(' '))
flag = True
for i in range(1, n + 1):
	row = input()
	if flag and 'B' in row:
		ith_cnt = i
		ith_row = row
		flag = False
cnt = ith_row.count('B')
for j in range(1, m + 1):
	if ith_row[j - 1] == 'B':
		jth_cnt = j
		break
print(ith_cnt + cnt // 2, jth_cnt + cnt // 2)


(n, m) = map(int, input().split())
for i in range(n):
	(h, k, f, x) = (0, 0, 0, 0)
	l = list(input())
	for j in range(m):
		if l[j] == 'B' and h == 0:
			h = j + 1
			f = i + 1
			x = 1
		if l[j] == 'B':
			k += 1
	if x == 1:
		break
print(f + k // 2, h + k // 2)


import math
a = input().split(' ')
n = int(a[0])
m = int(a[1])
s = []
for z in range(n):
	a = str(input())
	s.append(a)

def countB():
	b = 0
	for i in range(0, n):
		for j in range(0, m):
			if s[i][j] == 'B':
				b = b + 1
	return b
qb = countB()
bSqrt = int(math.sqrt(qb))

def middleSquare():
	if qb == 1:
		for i in range(0, n):
			for j in range(0, m):
				if s[i][j] == 'B':
					r = i + 1
					c = j + 1
					anser = (r, c)
					return anser
	else:
		side = bSqrt // 2
		for i in range(0, n):
			for j in range(0, m):
				if s[i][j] == 'B':
					r = i + 1 + side
					c = j + 1 + side
					anser = (r, c)
					return anser
middle = middleSquare()
r = middle[0]
c = middle[1]
print('{:2d} {:2d}'.format(r, c))


from math import sqrt
(n, m) = map(int, input().split())
table = ''
for i in range(0, n):
	table += input()
s = n * m
k = 0
for i in range(0, s):
	if table[i] == 'B':
		k += 1
		col = i % m + 1
		row = i // m + 1
k = int(sqrt(k)) // 2
col = col - k
row = row - k
print(row, col)


(n, m) = map(int, input().split())
min11 = 10000000
min12 = 10000000
max21 = 0
max22 = 0
for i in range(n):
	s = input()
	for j in range(m):
		if s[j] == 'B':
			max21 = i
			max22 = j
			min11 = min(min11, i)
			min12 = min(min12, j)
print((min11 + max21 + 2) // 2, (min12 + max22 + 2) // 2)


import math
(n, m) = list(map(int, input().split()))
inp = []
for i in range(n):
	inp.append(input())
out = []
c = 0
for i in range(n):
	for j in range(m):
		if inp[i][j] == 'B':
			out.append([i + 1, j + 1])
			c += 1
z = int(math.sqrt(c)) // 2
if c == 1:
	print(out[0][0], out[0][1])
else:
	print(out[0][0] + z, out[0][1] + z)


(n, m) = map(int, input().split())
data = []
blacklist = []
middlelist = []
for i in range(n):
	a = input()
	data.append(a)
	if 'B' in a:
		blacklist.append(i)
mr = blacklist[int((len(blacklist) + 1) / 2) - 1]
for j in range(len(data[mr])):
	if data[mr][j] == 'B':
		middlelist.append(j)
print(str(blacklist[int((len(blacklist) + 1) / 2) - 1] + 1) + ' ' + str(middlelist[int((len(middlelist) + 1) / 2) - 1] + 1))


(n, m) = map(int, input().strip().split())
arr = []
for i in range(n):
	arr.append([i for i in input()])
(l, r) = (0, m)
(t, b) = (0, n)
fb = False
for (i, arr_in) in enumerate(arr):
	for (j, val) in enumerate(arr_in):
		if fb is False and val == 'B':
			(l, t) = (j, i)
			fb = True
		if val == 'B':
			(r, b) = (j, i)
(mh, mw) = ((b - t) // 2 + (b - t) % 2, (r - l) // 2 + (r - l) % 2)
print(mh + t + 1, mw + l + 1)


I = lambda : list(map(int, input().split()))
(n, m) = I()
a = [input() for _ in range(n)]
mx = 0
idx = 0
for (i, s) in enumerate(a):
	if s.count('B') > mx:
		mx = s.count('B')
		idx = i
a = zip(*a)
(mx1, idx1) = (0, 0)
for (i, s) in enumerate(a):
	if s.count('B') > mx1:
		mx1 = s.count('B')
		idx1 = i
print(idx + mx // 2 + 1, idx1 + mx1 // 2 + 1)


(n, m) = map(int, input().split())
matx = []
for i in range(n):
	matx.append(str(input()))
y = []
x = []
flag = False
for i in range(n):
	if 'B' in matx[i]:
		if flag == False:
			y.append(matx[i].index('B') + 1)
			y.append(matx[i].count('B'))
			flag = True
		x.append(i + 1)
print(f'{x[int(len(x) / 2)]} {int((y[0] + sum(y)) / 2)}')


(n, m) = map(int, input().split())
l = [[0] for i in range(n)]
ans = False
r = int
c = int
count = 0
for i in range(n):
	l[i] = str(input())
	for item in l[i]:
		if item == 'B':
			count += 1
			if not ans:
				r = l[i].index(item)
				c = i
				ans = True
			break
cen = count // 2
if l[c + cen][r + cen] == 'B':
	print(c + cen + 1, r + cen + 1)
elif count == 1:
	print(c + 1, r + 1)


import math
(n, m) = map(int, input().split())
s = []
for i in range(n):
	ss = input()
	s += [ss]
for i in range(n):
	start = s[i].find('B')
	if start != -1:
		start = start + 1
		end = s[i].rfind('B') + 1
		leng = end - start + 1
		print(i + 1 + math.floor(leng / 2), start + math.floor(leng / 2))
		break


(n, m) = map(int, input().split())
matrix = []
first = True
for i in range(n):
	s = input()
	if 'B' in s:
		if first:
			x = i
			first = False
			row = s
		y = i
x_coor = x + (y - x - 1) // 2 if (y - x - 1) % 2 == 0 else x + 1 + (y - x - 1) // 2
first = True
for j in range(m):
	if row[j] == 'B':
		if first:
			x = j
			first = False
		y = j
y_coor = x + (y - x - 1) // 2 if (y - x - 1) % 2 == 0 else x + 1 + (y - x - 1) // 2
print(x_coor + 1, y_coor + 1)


(n, k) = input().split()
(n, k) = (int(n), int(k))
a = []
v = []
for i in range(n):
	aa = input()
	a.append(list(aa))
for i in range(n):
	for j in range(k):
		if a[i][j] == 'B':
			v.append([i + 1, j + 1])
ans = v[len(v) // 2]
for i in range(len(ans)):
	print(ans[i], end=' ')


a = input().split()
n = int(a[0])
m = int(a[1])
source = []
for i in range(n):
	tmp = input()
	source.append(tmp)
row = 0
column = 0
tr = tc = 0
cnt = 0
for i in range(n):
	column = 0
	for ii in range(m):
		if source[i][ii] == 'B':
			tr += row
			tc += column
			cnt += 1
		column += 1
	row += 1
aaa = tr / cnt
bbb = tc / cnt
print(int(aaa + 1), end=' ')
print(int(bbb + 1))


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
for j in range(len(a)):
	f = a[j].find('B')
	if f != -1:
		break
	else:
		continue
while n > 0:
	g = a[n - 1].rfind('B')
	if g != -1:
		break
	else:
		n = n - 1
avgr = (j + n) // 2
ch = a[avgr].find('B')
cl = a[avgr].rfind('B')
avgc = (ch + cl) // 2
print(avgr + 1, avgc + 1)


(r, c) = [int(i) for i in input().split()]
s = ''
bfb = 0
fb = 0
nbr = 0
for i in range(0, r):
	sa = input()
	if 'B' in sa:
		s = sa
		fb = 1
		nbr += 1
	elif fb == 0:
		bfb += 1
bfb1 = 0
fb = 0
nb = 0
for i in s:
	if i == 'B':
		fb = 1
		nb += 1
	elif fb == 0:
		bfb1 += 1
print(bfb + nbr // 2 + 1, bfb1 + nb // 2 + 1)


import math
s = input().split(' ')
num = int(s[0])
n_line = num
para = []
while n_line > 0:
	line = input()
	para.append(line)
	n_line = n_line - 1
(b, s_line, s_col) = (0, 0, 0)
for (i, j) in enumerate(para):
	for (m, n) in enumerate(j):
		if n == 'B':
			s_line = i
			s_col = m
			b = b + 1
xapxi = int((math.sqrt(b) - 1) / 2)
print(s_line + 1 - xapxi, s_col + 1 - xapxi)


(num_rows, num_columns) = map(int, input().split())
min_column = num_columns
max_column = 1
min_row = num_rows
max_row = 1
for row_pos in range(1, num_rows + 1):
	row = input()
	for (column_pos, char) in enumerate(row):
		if char == 'B':
			min_column = min(min_column, column_pos + 1)
			max_column = max(max_column, column_pos + 1)
			min_row = min(min_row, row_pos)
			max_row = max(max_row, row_pos)
print(f'{min_row + (max_row - min_row) // 2} {min_column + (max_column - min_column) // 2}')


(n, m) = map(int, input().split())
q = []
for iii in range(n):
	q.append(input())
r = -1
c = -1
rr = 0
cc = 0
flag = 0
for i in range(n):
	for j in range(m):
		if q[i][j] == 'B':
			count = 0
			for k in range(j, m):
				if q[i][k] == 'B':
					count += 1
					c = j + count // 2
			count = 0
			for k in range(i, n):
				if q[k][j] == 'B':
					count += 1
					r = i + count // 2
			flag = 1
			break
	if flag == 1:
		break
print(r + 1, c + 1)


(n, m) = map(int, input().split())
y = []
(x1, y1) = ([], [])
for i in range(n):
	x = list(input())
	y.append(x)
for i in range(n):
	for j in range(m):
		if y[i][j] == 'B' and j + 1 not in x1:
			x1.append(j + 1)
for i in range(m):
	for j in range(n):
		if y[j][i] == 'B' and j + 1 not in y1:
			y1.append(j + 1)
print(y1[len(y1) // 2], x1[len(x1) // 2])


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)


import math
a = list(map(int, input().split()))
field = []
lensqr = 0
begin = []
answer = False
for i in range(a[0]):
	field.append(input())
	for j in range(a[1]):
		if not answer:
			if field[i][j] == 'B' and j != a[1] - 1:
				lensqr += 1
				if len(begin) == 0:
					begin = [i, j]
			elif (lensqr > 0 or (j == a[1] - 1 and field[i][j] == 'B')) and (j == a[1] - 1 or field[i][j] == 'W'):
				if len(begin) == 0:
					begin = [i, j]
					lensqr += 1
				elif j == a[1] - 1:
					lensqr += 1
				l = math.ceil(lensqr / 2)
				begin = [begin[0] + l, begin[1] + l]
				answer = True
				break
print(' '.join(list(map(str, begin))))


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) = map(int, input().split())
ls = []
for i in range(n):
	ls.append(input())
for j in range(n):
	if 'B' in ls[j]:
		cnt = ls[j].count('B')
		ind = ls[j].index('B')
		break
row = j + cnt // 2
col = ind + cnt // 2
print(row + 1, col + 1)


IL = lambda : list(map(int, input().split()))
(n, m) = IL()
S = [input() for i in range(n)]
r = [i for (i, s) in enumerate(S) if s.count('B')]
c = [i for (i, s) in enumerate(S[r[0]]) if s == 'B']
print(r[len(r) // 2] + 1, c[len(c) // 2] + 1)


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


(a, b) = map(int, input().split())
l1 = []
l2 = []
for i in range(0, a):
	l = input()
	for j in l:
		if j == 'B':
			l1.append(i)
			l2.append(l)
			break
for k in range(0, b):
	if l2[0][k] == 'B':
		s = k + 1
		break
for m in range(b - 1, -1, -1):
	if l2[0][m] == 'B':
		t = m + 1
		break
ans = (s + t) // 2
cnt = (l1[0] + l1[len(l1) - 1]) // 2 + 1
print('%d %d' % (cnt, ans))


(n, m) = [int(x) for x in input().split()]
s = []
for i in range(n):
	x = list(input())
	try:
		a = x.index('B')
		cc = a
		c = x[a]
		count = 0
		while c == 'B' and a < m - 1:
			count += 1
			c = x[a + 1]
			a = a + 1
		s.append((i, cc, count))
	except:
		continue
aa = s[len(s) - 1]
x = aa[0]
y = aa[2]
start = aa[1]
print(int((x - s[0][0]) / 2) + s[0][0] + 1, start + int(y / 2) + 1)


(m, n) = [int(i) for i in input().split()]
l = []
for i in range(m):
	l.append(input().strip())
ansr = 0
ansc = 0
f = 0
for i in range(m):
	if l[i].__contains__('B'):
		startr = l[i].index('B')
		endr = l[i].count('B')
		ansc = startr + endr // 2
		j = i
		while j < m and l[j][startr] == 'B':
			j += 1
		ansr = i + (j - i) // 2
		f = 1
	if f == 1:
		break
print(ansr + 1, ansc + 1)


(n, m) = map(int, input().split())
f = True
for i in range(1, n + 1):
	row = input()
	if f and 'B' in row:
		begin = row.find('B') + 1
		end = row.rfind('B') + 1
		l = end - begin
		(r, c) = ((i + (i + l)) // 2, (begin + end) // 2)
		f = False
print('{} {}'.format(r, c))


(n, m) = [int(x) for x in input().split()]
grid = []
for i in range(n):
	grid.append(input() + 'W')
found = False
i = 0
j = 0
while i < n:
	while j < m:
		if grid[i][j] == 'B':
			w = 0
			while grid[i][j + w] == 'B':
				w += 1
			print(1 + i + w // 2, 1 + j + w // 2)
			i = n
			j = m
		j += 1
	i += 1
	j = 0


T_ON = 0
DEBUG_ON = 1
MOD = 998244353

def solve():
	(n, m) = read_ints()
	M = []
	for i in range(n):
		M.append(input())
	r1 = 0
	c1 = 0
	for r in range(n):
		if 'B' in M[r]:
			r1 = r
			c1 = M[r].index('B')
			break
	r2 = n - 1
	c2 = m - 1
	for r in reversed(range(n)):
		if 'B' in M[r]:
			r2 = r
			c2 = c1 + M[r].count('B') - 1
			break
	print((r1 + r2) // 2 + 1, (c1 + c2) // 2 + 1)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
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')

def read_int():
	return int(input())

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

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

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

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


(n, m) = map(int, input().split())
s = [''] * n
for i in range(n):
	s[i] = input()
for i in range(n):
	for j in range(m):
		if s[i][j] == 'B':
			cnt = 1
			for k in range(j + 1, m):
				if s[i][k] == 'B':
					cnt += 1
				else:
					break
			print(i + 1 + cnt // 2, j + 1 + cnt // 2)
			exit(0)


(r, c) = map(int, input().split())
for i in range(r):
	s = input()
	a = s.find('B')
	if a > -1:
		j = a
		while j < c and s[j] == 'B':
			j += 1
		print(i + 1 + (j - a) // 2, a + 1 + (j - a) // 2)
		exit()


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

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

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

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def ceildiv(x, y):
	return (x + y - 1) // y
(n, m) = map(int, input().split())
l = [list(map(str, input())) for i in range(n)]
r = 0
c = 0
ln = 0
ch = 0
for i in range(n):
	for j in range(m):
		if l[i][j] == 'B':
			r = i + 1
			c = j + 1
			ln = l[i].count('B')
			ch = 1
			break
	if ch:
		break
print(r + ln // 2, c + ln // 2)


(a, b) = list(map(int, input().strip(' ').split(' ')))
data = [[b for b in input()] for a in range(a)]
data = [c for dat in data for c in dat]
fir = data.index('B')
(x0, y0) = (fir // b, fir % b)
last = len(data) - list(reversed(data)).index('B') - 1
(x1, y1) = (last // b, last % b)
print(int((x0 + x1) / 2) + 1, int((y0 + y1) / 2) + 1)


from collections import Counter
(n, m) = list(map(int, input().split()))
arra = []
for x in range(n):
	arra.append(input())
i = -1
j = -1
flag = False
for x in range(0, n):
	if 'B' in arra[x]:
		flag = True
		for y in range(0, m):
			if arra[x][y] == 'B':
				test = Counter(arra[x])
				break
	if flag:
		break
mid = int(test['B'] / 2)
print(str(x + 1 + mid) + ' ' + str(y + 1 + mid))


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


s = input().split()
(n, m) = (int(s[0]), int(s[1]))
cl = []
for i in range(n):
	cl.append(input())
for i in range(n):
	for j in range(m):
		if cl[i][j] == 'B':
			t = 0
			while j + t < m and cl[i][j + t] == 'B':
				t += 1
			s = 0
			while i + s < n and cl[i + s][j] == 'B':
				s += 1
			print('{} {}'.format(i + (t + 1) // 2, j + (s + 1) // 2))
			exit()


(n, m) = map(int, input().split())
s = []
r = 0
c = 0
r1 = c1 = 116
r2 = c2 = 0
for i in range(n):
	s.append(list(input().rstrip()))
for i in range(n):
	if 'B' in s[i]:
		r1 = min(r1, i)
		r2 = max(r2, i)
		c1 = min(c1, s[i].index('B'))
	r = (r1 + r2) // 2 + 1
	c = c1 + 1 + (r2 - r1) // 2
print(r, c)


(r, c) = map(int, input().split())
grid = [input() for _ in range(r)]
pos = [(x, y) for x in range(r) for y in range(c) if 'B' == grid[x][y]]
tup = pos[len(pos) // 2]
print('%d %d' % (tup[0] + 1, tup[1] + 1))


(n, m) = list(map(int, input().split()))
e = []
for x in range(n):
	e.append(input())
row = 0
l = 0
r = 0
k = 0
for x in range(n):
	if 'B' in e[x]:
		if l == 0:
			row = x
			k = 1
		l += 1
		r += 1
		t = x
	if k == 1:
		col = 1 + e[x].count('B') // 2 + e[x].find('B')
		k = 2
print(row + 1 + (r - 1) // 2, col)


(n, m) = input().split()
n = int(n)
m = int(m)
matrix = []
for x in range(n):
	matrix = matrix + [input()]
a = 0
b = 0
count = 0
while a < n:
	b = 0
	while b < m:
		if matrix[a][b] == 'B':
			break
		if matrix[a][b] != 'B':
			count = count + 1
		b = b + 1
	if b < m:
		if matrix[a][b] == 'B':
			break
	a = a + 1
ib = b
while b < m:
	if matrix[a][b] == 'W':
		break
	b = b + 1
fb = b
k = (fb - ib) // 2 + 1
if count == m * n:
	print(0, 0)
else:
	print(a + k, ib + k)


(n, m) = map(int, input().split())
k = 0
stroka = stolb = -1
br = False
for i in range(n):
	j = 0
	for color in input():
		if color == 'B':
			k += 1
			if stroka == stolb == -1:
				stroka = i
				stolb = j
			br = True
		j += 1
	if br:
		break
k = k // 2 + 1
print(stroka + k, stolb + k)


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	arr.append(str(input()))
x1 = -1
y1 = -1
x2 = -1
y2 = -1
for i in range(n):
	for j in range(m):
		if arr[i][j] == 'B':
			if x1 == -1:
				x1 = i
			if y1 == -1:
				y1 = j
			if i > x2:
				x2 = i
			if j > y2:
				y2 = j
print(int((x1 + x2 + 2) // 2), int((y1 + y2 + 2) // 2))


(n, m) = map(int, input().split())
l = []
(ir, ic, c) = (0, 0, 0)
for i in range(n):
	temp = list(map(str, input().strip()))
	l.append(temp)
for i in range(n):
	for j in range(m):
		if l[i][j] == 'B':
			ir = i
			ic = j
			break
	if j < m - 1:
		break
for i in range(ir + 1, n):
	if l[i][ic] == 'B':
		c += 1
	else:
		break
print(ir + c // 2 + 1, ic + c // 2 + 1)


import itertools
import math
from collections import defaultdict

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

def solve():
	(n, m) = input_ints()
	s = []
	for i in range(n):
		s.append(input())
	for d in range(60, -1, -1):
		for (x, y) in itertools.product(range(d, n - d + 1), range(d, m - d + 1)):
			ok = True
			for i in range(x - d, x + d + 1):
				if s[i][y - d:y + d + 1].count('B') != 2 * d + 1:
					ok = False
					break
			if ok:
				print(x + 1, y + 1)
				return
solve()


(n, m) = map(int, input().split())
x = 0
y = 0
f = 0
for i in range(n):
	s = input()
	if 'B' in s and f == 0:
		b = s.find('B') + 1
		e = s.rfind('B') + 1
		d = e - b
		x = i + 1 + d // 2
		y = (b + e) // 2
		f = 1
print(x, y)


def test_0():
	import math
	from collections import Counter
	(n, m) = list(map(int, input().split(' ')))
	data = []
	x_1 = -1
	x_2 = 0
	y_1 = 0
	y_2 = 0
	for i in range(1, n + 1):
		data_1 = input().strip()
		a = data_1.find('B')
		b = data_1.count('B')
		if a != -1 and x_1 == -1:
			x_1 = i
			y_1 = a + 1
			y_2 = b
		if a != -1:
			x_2 += 1
	print(x_1 + x_2 // 2, y_1 + y_2 // 2)
test_0()


(n, m) = map(int, input().split())
for i in range(1, n + 1):
	s = input()
	c = s.count('B')
	if c > 0:
		break
y = s.index('B') + 1
print(i + c // 2, y + c // 2)


(n, m) = map(int, input().split())
M = [['0' for x in range(m)] for y in range(n)]
for a in range(n):
	i = input()
	for b in range(len(i)):
		M[a][b] = i[b]
start = []
end = []
for a in range(n):
	for b in range(m):
		if M[a][b] == 'B':
			if not start:
				start.append(a + 1)
				start.append(b + 1)
			else:
				end.clear()
				end.append(a + 1)
				end.append(b + 1)
if not start or not end:
	print(start[0], start[1])
else:
	mid1 = int((end[0] + start[0]) / 2)
	mid2 = int((end[1] + start[1]) / 2)
	print(mid1, mid2)


(n, m) = input().split()
n = int(n)
m = int(m)
i = 1
while i > 0:
	k = input()
	t = k.find('B')
	if t != -1:
		m = (k.rfind('B') - t) // 2
		print('{} {}'.format(i + m, t + m + 1))
		exit(0)
	i += 1


(n, m) = map(int, input().split())
for i in range(n):
	A = input()
	x = A.count('B')
	if x > 1:
		y = A.index('B')
		if y == 0:
			print(i + (x + 1) // 2, (x + 1) // 2)
			break
		else:
			print(i + (x + 1) // 2, y + (x + 1) // 2)
			break
	elif x == 1:
		y = A.index('B')
		print(i + 1, y + 1)
		break


(n, m) = [int(x) for x in input().split()]
a = []
f = [999, 999]
l = [0, 0]
for i in range(n):
	s = list(input())
	a.append(s)
	for j in range(m):
		if s[j] == 'B':
			if f[0] + f[1] > i + j:
				f = [i, j]
			if i + j > l[0] + l[1]:
				l = [i, j]
print((f[0] + l[0]) // 2 + 1, (f[1] + l[1]) // 2 + 1)


(x, y) = map(int, input().split())
a = []
for i in range(x):
	a.append(input())
for i in range(x):
	if a[i].count('B') > 0:
		exit(print(i + a[i].count('B') // 2 + 1, a[i].index('B') + a[i].count('B') // 2 + 1))


(n, m) = map(int, input().split())
colum2 = []
for i in range(1, n + 1):
	a = input()
	column1 = []
	column = 1
	for c in a:
		if c == 'B':
			column1.append([i, column])
			column += 1
		else:
			column += 1
	if len(column1) != 0:
		colum2.append(column1)
ans = colum2[len(colum2) // 2][len(colum2[0]) // 2]
print(*ans)


def solve():
	(n, m) = list(map(int, input().split()))
	grid = []
	for i in range(n):
		grid.append(list(input()))
	i = 0
	found = False
	while found is False and i < n * m:
		if grid[i // m][i % m] == 'B':
			found = True
			continue
		i = i + 1
	start_i = i // m
	start_j = i % m
	end_i = start_i
	end_j = start_j
	while end_i + 1 < n and grid[end_i + 1][end_j] != 'W':
		end_i += 1
	while end_j + 1 < m and grid[end_i][end_j + 1] != 'W':
		end_j += 1
	print((end_i + start_i) // 2 + 1, (end_j + start_j) // 2 + 1)
solve()


(n, m) = map(int, input().split())
array = []
for i in range(n):
	array.append(list(input()))
(x1, x2, y1, y2) = (120, 0, 120, 0)
rowCount = 0
for row in array:
	rowCount += 1
	colCount = 0
	for item in row:
		colCount += 1
		if item == 'B':
			x1 = min(x1, colCount)
			x2 = max(x2, colCount)
			y1 = min(y1, rowCount)
			y2 = max(y2, rowCount)
print(int((y1 + y2) / 2), int((x1 + x2) / 2))


(n, m) = map(int, input().split())
(x, y, cnt) = (0, 0, 0)
for i in range(n):
	s = input()
	pos = []
	for j in range(m):
		if s[j] == 'B':
			x += i
			y += j
			cnt += 1
print(x // cnt + 1, y // cnt + 1)


(n, m) = map(int, input().split())
arr = [list(input()) for i in range(n)]
for i in range(n):
	if 'B' in arr[i]:
		y = i
		x = arr[i].index('B')
		break
for i in range(n - 1, -1, -1):
	if 'B' in arr[i]:
		y1 = i
		x1 = m - arr[i][::-1].index('B')
		break
print((y1 + y) // 2 + 1, (x + x1) // 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


import re
l = []
l = input()
l = l.split()
n = int(l[0])
m = int(l[1])
b = []
for i in range(n):
	r = input()
	b.append(r)
r = 0
c = 0
d = {}
for i in range(len(b)):
	a = str(b[i])
	t = re.search('B', a)
	if t:
		m = int(t.start())
	c = 0
	for j in a:
		c = c + 1
		if j == 'B':
			d[i + 1] = c + int(m) + 1
k = int((len(d) + 1) / 2)
c = 1
for (key, value) in d.items():
	if c == k:
		print(key, int(value / 2))
	c = c + 1


(n, m) = map(int, input().split())
x1 = -1
x2 = -1
y1 = -1
y2 = -1
for i in range(n):
	s = input()
	for j in range(m):
		if s[j] == 'B':
			if x1 == -1:
				x1 = j + 1
			x2 = max(x2, j + 1)
			if y1 == -1:
				y1 = i + 1
			y2 = i + 1
print((y1 + y2) // 2, (x1 + x2) // 2)


(n, m) = map(int, input().split())
r = 0
c = 0
for i in range(n):
	s = list(str(input()))
	if s.count('B') != 0 and r == 0:
		c = s.index('B') + s.count('B') // 2 + 1
		r = i + s.count('B') // 2 + 1
print(r, c)


(n, m) = map(int, input().split())
arr = ['' for i in range(n)]
for i in range(n):
	arr[i] = input()
k = 0
s = 200
for i in range(n):
	for j in range(m):
		if arr[i][j] == 'B':
			s = min(j, s)
			k += 1
	if k != 0:
		print(i + 1 + k // 2, s + 1 + k // 2)
		break


(n, m) = [int(x) for x in input().split(' ')]
for i in range(n):
	c = input()
	if 'B' in c:
		cnt = c.count('B')
		fb = c.index('B')
		wc = cnt // 2 + 1
		row = fb + wc
		col = i + cnt // 2 + 1
		print(col, row)
		break


(n, m) = [int(x) for x in input().split()]
matrix = []
k = []
d = []
for i in range(n):
	s = input()
	matrix.append(s)
for i in range(n):
	for j in range(m):
		if matrix[i][j] == 'B':
			k.append(i + 1)
			d.append(j + 1)
print(sum(k) // len(k), sum(d) // len(d))


from string import *
(r, c) = input().split()
(r, c) = (int(r), int(c))
inputs = []
indexes = []
for i in range(r):
	inputs.append(str(input()))
count = 0
for i in inputs:
	count += 1
	if i.find('B') > -1:
		indexes.append(count)
center = len(indexes) // 2
row = indexes[center]
col = inputs[row - 1].find('B') + center + 1
print(row, col)


(n, m) = map(int, input().split())
a = []
x = 0
y = 0
verti = []
for i in range(n):
	a = list(input())
	temp = a.count('B')
	if temp > 0:
		verti.append(i)
		if y == 0:
			y = a.index('B') + temp // 2
print(verti[len(verti) // 2] + 1, y + 1)


(y, x) = [int(i) for i in input().split()]
s = input()
i = 1
j = 1
while 'B' not in s:
	s = input()
	j = j + 1
k = s.index('B')
n = s.rindex('B')
i = k + (n - k) // 2 + 1
j = j + (n - k) // 2
print(j, i)


(n, m) = map(int, input().split())
a = [None] * n
for i in range(n):
	a[i] = input()
(fx, fy) = (-1, -1)
(lx, ly) = (-1, -1)
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B':
			if fx == -1 and fy == -1:
				(fx, fy) = (i + 1, j + 1)
			else:
				(lx, ly) = (i + 1, j + 1)
if lx == -1 and ly == -1:
	print(fx, fy)
else:
	print((fx + lx) // 2, (fy + ly) // 2)


s = input().split(' ')
n = int(s[0])
m = int(s[1])
s1 = []
for i in range(n):
	s1.append(input())
start = 0
f = True
for i in range(n):
	for j in range(len(s1[i])):
		if s1[i][j] == 'B':
			start = j
			f = False
			break
	if not f:
		break
c = 0
for j in range(len(s1[i])):
	if s1[i][j] == 'B':
		c += 1
print(str(i + 1 + c // 2) + ' ' + str(start + 1 + c // 2))


(n, m) = map(int, input().split())
(nes, pos) = (0, 0)
for _ in range(n):
	s = input()
	if 'B' in s:
		nes = s.count('B')
		pos_r = _
		pos_c = s.index('B')
		break
step = nes // 2
pos_r += step + 1
pos_c += step + 1
print(pos_r, pos_c)


(n, m) = [int(i) for i in input().split()]
l = []
string = 0
for i in range(n):
	s = str(input())
	if 'B' in s:
		l.append(i)
		string = s
e = (l[-1] - l[0]) // 2
first = l[0] + e
first = first + 1
a = string.find('B')
b = m - 1 - string[::-1].find('B')
h = (b - a) // 2
second = a + h
second = second + 1
print(first, second)


(n, m) = map(int, input().split())
a = []

def is_center(a, y, x):
	count1 = count2 = count3 = count4 = 0
	y1 = y
	x1 = x
	while True:
		y2 = y1 - 1
		if y2 < 0:
			break
		c = a[y2][x]
		if c == 'W':
			break
		count1 += 1
		y1 = y2
	y1 = y
	x1 = x
	while True:
		y2 = y1 + 1
		if y2 == n:
			break
		c = a[y2][x]
		if c == 'W':
			break
		count2 += 1
		y1 = y2
	y1 = y
	x1 = x
	while True:
		x2 = x1 - 1
		if x2 < 0:
			break
		c = a[y1][x2]
		if c == 'W':
			break
		count3 += 1
		x1 = x2
	y1 = y
	x1 = x
	while True:
		x2 = x1 + 1
		if x2 == m:
			break
		c = a[y1][x2]
		if c == 'W':
			break
		count4 += 1
		x1 = x2
	return count1 == count2 == count3 == count4 and a[y][x] == 'B'
for k in range(n):
	s = input()
	a.append(s)
for y in range(n):
	c = False
	for x in range(m):
		if is_center(a, y, x):
			print(y + 1, x + 1)
			c = True
			break
	if c:
		break


import sys
(n, m) = map(int, input().split())
s = [input() for i in range(n)]
(x, y) = (-1, -1)
for i in range(n):
	for j in range(m):
		if s[i][j] == 'B':
			(x, y) = (j, i)
			while x < m and s[i][x] == 'B':
				x += 1
			while y < n and s[y][j] == 'B':
				y += 1
			print(i + (y - i - 1) // 2 + 1, j + (x - j - 1) // 2 + 1)
			sys.exit()


(r, c) = map(int, input().split())
s = []
for i in range(r):
	s.append(input())
for i in range(r):
	if s[i].count('B') != 0:
		print(i + s[i].count('B') // 2 + 1, s[i].index('B') + s[i].count('B') // 2 + 1)
		break


from sys import stdin, stdout
from collections import deque
(n, m) = map(int, stdin.readline().split())
maps = []
for i in range(n):
	maps.append(stdin.readline().strip())
(s, c) = (0, 0)
for i in range(n):
	cnt = 0
	for j in range(m):
		if maps[i][j] == 'B':
			cnt += 1
	if cnt:
		break
label = 0
for i in range(n):
	for j in range(m):
		if maps[i][j] == 'B':
			stdout.write(str(i + cnt // 2 + 1) + ' ' + str(j + cnt // 2 + 1) + '\n')
			label = 1
			break
	if label:
		break


inputs = input().split(' ')
columns = int(inputs[0])
lines = []
for i in range(columns):
	lines.append(input())
index = None
end = None
hindex = None
for i in range(len(lines)):
	for j in range(len(lines[i])):
		if lines[i][j] == 'B':
			if index == None:
				index = j
				end = j
				hindex = i
			else:
				end += 1
		elif index is not None:
			break
	if index is not None:
		break
leng = end - index
print(1 + int(hindex + leng / 2), 1 + int(index + leng / 2))


f = 1
(r, n) = map(int, input().split())
for x in range(r):
	s = input()
	s1 = len(s)
	s2 = len(s)
	if f == 1:
		for i in range(len(s)):
			if s[i] == 'B' and f == 1:
				s1 = i
				f = 0
				p = x
				if s1 == len(s) - 1:
					s2 = s1
			if i >= s1 and f == 0:
				if s[i] != 'B':
					s2 = i - 1
					break
	if f == 0:
		ans1 = (s2 - s1) // 2 + s1
		ans2 = (s2 - s1) // 2 + p
		print()
		print(ans2 + 1, ans1 + 1)
		break


(n, m) = map(int, input().split())
flag = False
for i in range(n):
	s = input()
	for j in range(m):
		if s[j] == 'B' and flag == False:
			flag = True
			fi = j
		elif s[j] == 'W' and flag == True:
			break
	if flag == True:
		break
print(i + (j - fi) // 2 + 1, fi + (j - fi) // 2 + 1)


import sys
import math
(n, m) = map(int, input().split())
mata = []
(conta, aa, bb) = (0, 0, 0)
for i in range(n):
	lisa = [str(x) for x in input().strip().split()]
	mata.append(lisa)
flag = False
for i in range(n):
	kaa = mata[i][0]
	for j in range(len(kaa)):
		if kaa[j] == 'B':
			conta += 1
			if flag == False:
				(aa, bb) = (i, j)
				flag = True
side = math.sqrt(conta) // 2
(aa, bb) = (aa + 1, bb + 1)
print(int(aa + side), int(bb + side))


__author__ = 'Dilshod'
(n, m) = map(int, input().split())
a = 0
d = True
for i in range(n):
	s = input()
	if 'B' in s:
		a += 1
		if d:
			e = i + 1
			b = s.find('B')
			c = s.rfind('B')
			d = False
		f = i + 1
print((f + e) // 2, (b + c) // 2 + 1)


input()
i = j = -1
while j < 0:
	s = input()
	j = s.find('B')
	i += 1
print(i + s.count('B') // 2 + 1, j + s.count('B') // 2 + 1)


import math
try:
	(n, m) = map(int, input().split())
	square = []
	for each in range(0, n):
		c = input()
		square.append(list(c))
	start = end = 0
	flag = 0
	for each in range(0, n):
		if flag == 0:
			for each_char in range(0, m):
				row_cal = each + 1
				if square[each][each_char] == 'B':
					if start == 0:
						start = each_char + 1
						end = each_char + 1
						flag = 1
					else:
						end = each_char + 1
						flag = 1
	col = start - 1 + math.ceil((end - start + 1) / 2)
	row = row_cal - 1 + math.ceil((end - start + 1) / 2)
	print(row, col)
except:
	pass


(n, m) = input().split()
n = int(n)
m = int(m)
maps = []
for i in range(n):
	maps.append(input())
i = 0
b_index = maps[i].find('B')
while b_index == -1:
	i += 1
	b_index = maps[i].find('B')
center_x = (maps[i].rfind('B') + b_index) // 2
center_y = i + center_x - b_index
print('{} {}'.format(center_y + 1, center_x + 1))


(n, m) = map(int, input().split())
matr = []
for i in range(n):
	s = input()
	l = []
	for x in s:
		l.append(x)
	matr.append(l)
for i in range(n):
	if 'B' in matr[i]:
		i1 = i + 1
		break
for i in range(n):
	if 'B' in matr[i]:
		i2 = i + 1
for j in range(m):
	if matr[i1 - 1][j] == 'B':
		j1 = j + 1
		break
a = i2 - i1
print(i1 + a // 2, j1 + a // 2)


(n, m) = map(int, input().split())
t = n
q = m
s1 = 0
s2 = 0

def reverse(s):
	str = ''
	for i in s:
		str = i + str
	return str
for i in range(1, n + 1):
	s = input()
	x = s.find('B')
	if x != -1:
		x = x + 1
		p = reverse(s)
		u = p.find('B')
		u = m - u
		s1 = (u + x) / 2
		diff = u - s1
		s2 = i + diff
		break
print(int(s2), '\t', int(s1))


(n, m) = map(int, input().split())
s = []
a = 0
b = 0
c = 0
for i in range(n):
	s.append(input())
	for j in range(m):
		if s[-1][j] == 'B':
			c += 1
			a += i + 1
			b += j + 1
print(a // c, b // c)


(n, m) = map(int, input().rstrip().split(' '))
blackFirstRow = 0
left = 0
right = 0
for _ in range(n):
	row = input().rstrip()
	i = 0
	for i in range(m):
		if row[i] == 'B':
			left = i + 1
			break
	for i in range(m - 1, -1, -1):
		if row[i] == 'B':
			right = i + 1
			break
	if left != 0:
		blackFirstRow = _ + 1
		break
centerRow = (blackFirstRow + (blackFirstRow + right - left)) // 2
centerColumn = (left + right) // 2
print(centerRow, centerColumn)


(n, m) = map(int, input().split())
a = [input() for i in range(n)]
l = []
for i in range(n):
	if 'B' in a[i]:
		x = []
		j = 0
		while j < m:
			if a[i][j] == 'B':
				x.append((i, j))
			j += 1
		l.append(x)
p = int((l[-1][0][0] + l[0][0][0]) / 2)
q = int((l[-1][-1][1] + l[-1][0][1]) / 2)
print(p + 1, q + 1)


(n, m) = map(int, input().split())
a = [input() for i in range(n)]
l = []
for i in range(n):
	if 'B' in a[i]:
		if a[i].count('B') > 1:
			flag = 1
		c = []
		j = 0
		while j < m:
			if a[i][j] == 'B':
				c.append((i, j))
			j += 1
		l.append(c)
x = int((l[-1][0][0] + l[0][0][0]) / 2)
y = int((l[-1][0][-1] + l[-1][-1][1]) / 2)
print(x + 1, y + 1)


def solve(a, n, m):
	(x1, x2) = (1000, 0)
	(y1, y2) = (1000, 0)
	for i in range(n):
		for j in range(m):
			if a[i][j] == 'B':
				x1 = min(x1, i)
				x2 = max(x2, i)
				y1 = min(y1, j)
				y2 = max(y2, j)
	return ((x1 + x2) // 2 + 1, (y1 + y2) // 2 + 1)

def main():
	(n, m) = [int(_) for _ in input().split()]
	a = [input() for i in range(n)]
	print(*solve(a, n, m))
main()


import math
(n, m) = map(int, input().split())
for i in range(1, n + 1):
	s = input()
	if 'B' in s:
		print(int((i + i + s.count('B') - 1) / 2), int((s.index('B') + 1 + s.index('B') + 1 + s.count('B') - 1) / 2))
		break


(n, m) = map(int, input().split())
l = []
for i in range(n):
	l.append(input())
for i in range(n):
	x = l[i].find('B')
	if x >= 0:
		c = l[i].count('B')
		break
print(i + c // 2 + 1, x + c // 2 + 1)


(n, m) = map(int, input().split())
for i in range(1, n + 1):
	a = input()
	try:
		l = a.index('B')
		r = a.rindex('B')
		d = (r - l) // 2
		print(i + d, l + d + 1)
		break
	except ValueError:
		continue


def main():
	(n, m) = map(int, input().split())
	a = b = (-1, -1)
	for i in range(n):
		string = input()
		idx = string.find('B')
		ridx = string.rfind('B')
		if idx != -1 and a[0] == -1:
			a = (i, idx)
		if ridx != -1:
			b = (i, ridx)
	print(str(1 + (a[0] + b[0]) // 2) + ' ' + str(1 + (a[1] + b[1]) // 2))
main()


(n, m) = map(int, input().split())
up = -1
for row in range(n):
	a = input()
	if up < 0 and 'B' in a:
		up = row
		check = 0
		l = -1
		r = -1
		for i in range(m):
			if check == 0 and a[i] == 'B':
				l = i
				check += 1
			if check == 1 and a[i] == 'W':
				r = i
				check += 1
			if check > 1:
				break
		if r < 0:
			r = m
		break
y = (l + r) // 2 + 1
x = up + (r - l) // 2 + 1
print(x, y)


(n, m) = map(int, input().split())
a = []
for i in range(n):
	s = input()
	a.append(s)
h = 0
ind1 = 0
ind2 = 0
for i in range(0, len(a)):
	if a[i].find('B') != -1:
		h += 1
		ind1 = a[i].find('B') + 1
		ind2 = i + 1
if h % 2 == 0:
	h -= 1
print(ind2 - h // 2, ind1 + h // 2)


[n, m] = list(map(int, input().split()))
arr = []
ini = 1
shesh = []
for i in range(n):
	x = input('')
	for j in range(m):
		if x[j] == 'B':
			if ini:
				prothom = [i, j]
				ini = 0
			else:
				shesh = [i, j]
try:
	shesh[0]
except:
	shesh = prothom
x = 1 + (prothom[0] + shesh[0]) // 2
y = 1 + (prothom[1] + shesh[1]) // 2
print(x, y)


a = input()
c = []
x = 0
y = 0
a = list(map(int, a.split()))
for i in range(a[0]):
	b = input()
	c.append(b)
	if b.count('B') > 0:
		x = b.find('B')
		x = b.count('B') / 2 + x + 1
		y = i + 1 + b.count('B') / 2
		break
print(int(y), int(x))


(n, m) = list(map(int, input().split()))
z = []
p = []
r = []
for i in range(n):
	a = input()
	z.append(a)
for j in range(len(z)):
	for k in range(len(z[j])):
		if z[j][k] == 'B':
			p.append(j + 1)
b = (p[0] + p[-1]) // 2
for k in range(len(z[0])):
	if z[b - 1][k] == 'B':
		r.append(k + 1)
c = (r[0] + r[-1]) // 2
print(b, c)


import sys
input = sys.stdin.readline
(n, m) = 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] = [int(x) for x in input().split()]
a = []
b = []
flag = 0
for i in range(0, n):
	a.append('W' + str(input()) + 'W')
for i in range(0, n):
	for j in range(1, m + 2):
		if a[i][j] != a[i][j - 1]:
			flag = 100
			b.append(j)
			if a[i][j] == 'W':
				c = int(j - (b[1] - b[0]) / 2)
				r = int(i + (b[1] - b[0] + 1) / 2)
				break
	if flag == 100:
		break
print(r, c)


import os
import sys
import math

def main():
	(n, m) = [int(i) for i in input().split()]
	(centeri, centerj) = (-1, -1)
	(starti, startj) = (-1, -1)
	for i in range(n):
		s = input()
		if not 'B' in s:
			continue
		if starti == -1:
			starti = i
			a = [int(pos) for (pos, char) in enumerate(s) if char == 'B']
			centerj = min(a) + (max(a) - min(a)) / 2
			a = centerj - s.index('B')
			centeri = starti + a
	print('{} {}'.format(int(centeri + 1), int(centerj + 1)))
main()


import sys
import math
import bisect

def main():
	(n, m) = map(int, input().split())
	A = []
	for i in range(n):
		A.append(input())
	row = []
	col = []
	for i in range(n):
		for j in range(m):
			if A[i][j] == 'B':
				row.append(i)
				col.append(j)
	row = list(sorted(set(row)))
	col = list(sorted(set(col)))
	nr = len(row)
	nc = len(col)
	x = row[(nr - 1) // 2]
	y = col[(nc - 1) // 2]
	print('%d %d' % (x + 1, y + 1))
main()


inp = input()
(n, m) = inp.split(' ')
n = int(n)
m = int(m)
x = None
y = None
res = 1
for i in range(0, n):
	t = input()
	length = 1
	for j in range(0, m):
		if t[j] == 'B':
			if x is None and y is None:
				x = i
				y = j
			if j > 0 and t[j - 1] == 'B':
				length = length + 1
	if length > 1:
		res = length
print(x + 1 + int(res / 2), y + 1 + int(res / 2))


import math
(n, m) = map(int, input().split())
matrix = [[] for i in range(n)]
for i in range(n):
	matrix[i] = input()
r = 0
f = 0
c = 0
for j in range(n):
	for k in range(m):
		if matrix[j][k] == 'B' and f == 0:
			f = 1
			r = j
			c = k
r1 = r
c1 = c
while c < m and matrix[r][c] == 'B':
	if matrix[r][c] == 'B':
		c = c + 1
l = c - c1 + 1
cr = r1 + math.floor(l / 2)
cc = c1 + math.floor(l / 2)
print(cr, cc)


(n, m) = map(int, input().split())
matrix = []
c = 0
for i in range(n):
	row = list(str(input()))
	matrix.append(row)
for i in range(n):
	for j in range(m):
		if matrix[i][j] == 'B':
			c += 1
			break
	if c == 1:
		break
for x in range(n):
	for y in range(m):
		if matrix[x][y] == 'B':
			a = x + 1
			b = y + 1
i = i + 1
j = j + 1
print((i + a) // 2, end=' ')
print((j + b) // 2)


def solve(matrix, m, n):
	found = False
	(i, j, size) = (0, 0, 0)
	for (_i, row) in enumerate(matrix):
		if not found:
			for (_j, c) in enumerate(row):
				if not found and c == 'B':
					found = True
					(i, j) = (_i + 1, _j + 1)
				if c == 'B':
					size += 1
	diff = int(size / 2)
	print(i + diff, j + diff)
(m, n) = [int(x) for x in input().split(' ')]
matrix = []
for i in range(m):
	row = input()
	matrix.append(row)
solve(matrix, m, n)


(a, b) = [int(i) for i in input().split()]
c = [0 for i in range(a)]
flag = 0
j = 0
f = 0
for i in range(a):
	c[i] = input()
	if 'B' in c[i] and flag == 0:
		k = c[i].count('B')
		s = list(c[i])
		j = s.index('B')
		f = i
		flag = 1
print(f + 1 + k // 2, j + 1 + k // 2)


(n, m) = map(int, input().split())
a = []
for i in range(n):
	s = input()
	a.append(s)
k = 0
t = False
(i1, j1) = (0, 0)
for i in range(n):
	for j in range(m):
		h = a[i][j]
		if h == 'B' and (not t):
			t = True
			k += 1
			i1 = i
			j1 = j
		elif h == 'B':
			k += 1
	if t:
		break
print(i1 + k // 2 + 1, j1 + k // 2 + 1)


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


(x, y) = map(int, input().split())
for i in range(x):
	a = input()
	left = a.find('B')
	if left != -1:
		right = a.rfind('B')
		col = (left + right) // 2 + 1
		row = (right - left) // 2 + i + 1
		print(row, col)
		break


(n, m) = [int(i) for i in input().split()]
matrix = []
side = 0
x = 0
y = 0
for i in range(n):
	matrix.append([i for i in input()])
for i in range(n):
	for j in range(m):
		if matrix[i][j] == 'B':
			side += 1
			y = i
			x = j
	if side > 0:
		break
print(y + 1 + side // 2, x + 1 - side // 2)


(n, m) = map(int, input().split())
b = []
for i in range(n):
	b.append(input())
d = []
e = []
f = 0
for i in range(n):
	for j in range(m):
		if b[i][j] == 'B':
			d.append(i)
			e.append(j)
			f += 1
print(sum(d) // f + 1, sum(e) // f + 1)


(n, m) = map(int, input().split())
p = 0
mni = 0
mxe = 0
for i in range(n):
	a = list(input())
	for j in range(m):
		if a[j] == 'B':
			if p == 0:
				mni = i + 1
				mxe = j + 1
			p += 1
	if p != 0:
		break
l1 = (mni, mxe)
l2 = (mni + p - 1, mxe + p - 1)
xans = (l1[0] + l2[0]) // 2
yans = (l1[1] + l2[1]) // 2
print(xans, yans)


s = input().split()
(n, m) = (int(s[0]), int(s[1]))
s = ''
for i in range(n):
	s += input().rstrip()
i = (s.find('B') + n * m - 1 - s[-1::-1].find('B')) // 2
print(i // m + 1, end=' ')
print(i % m + 1)


(n, m) = map(int, input().split())
tab = [input() for i in range(n)]
(gora, dol) = (0, 0)
(gora_lewo, gora_prawo) = (0, 0)
znalazlem = False
for i in range(n):
	if znalazlem:
		break
	for j in range(m):
		if tab[i][j] == 'B':
			gora = i
			gora_lewo = j
			znalazlem = True
			break
for i in range(m):
	if tab[gora][i] == 'B':
		gora_prawo = i
dlugosc = gora_prawo - gora_lewo
print(gora + dlugosc // 2 + 1, gora_prawo - dlugosc // 2 + 1)


import sys
f = sys.stdin
out = sys.stdout
(n, m) = map(int, f.readline().rstrip('\r\n').split())
table = []
for i in range(n):
	s = f.readline().rstrip('\r\n')
	table.append(s)
(tli, tlj) = (0, 0)
for i in range(n):
	flag = 0
	for j in range(m):
		if table[i][j] == 'B':
			flag = 1
			(tli, tlj) = (i, j)
			break
	if flag == 1:
		break
(tri, trj) = (-1, -1)
(bli, blj) = (-1, -1)
i = tli
j = tlj
while j < m and table[i][j] == 'B':
	j += 1
tri = tli
trj = j - 1
j = tlj
while i < n and table[i][j] == 'B':
	i += 1
bli = i - 1
blj = tlj
(c1, c2) = ((bli - tli) // 2, (trj - tlj) // 2)
out.write(str(tli + c1 + 1) + ' ' + str(tlj + c2 + 1) + '\n')


(n, m) = map(int, input().split())
a = []
d = []
for i in range(n):
	b = input()
	e = b
	b = list(b)
	b.sort()
	a.append(b)
	e = list(e)
	d.append(e)
c1 = 0
c2 = 0
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B':
			c1 += 1
	if c1 != 0:
		break
for i in range(m):
	for j in range(n):
		if a[j][i] == 'B':
			c2 += 1
	if c2 != 0:
		break
if c1 > c2:
	c = c2
else:
	c = c1
flag = 0
for i in range(n):
	for j in range(m):
		if d[i][j] == 'B':
			flag = 1
			break
	if flag == 1:
		break
x1 = i + 1
x2 = i + c
y1 = j + 1
y2 = j + c
x = (x1 + x2) // 2
y = (y1 + y2) // 2
print(x, y)


(n, m) = map(int, input().split())
ls = []
f = 0
c = 0
for i in range(n):
	if f:
		continue
	s = input()
	l = list(s)
	for j in range(m):
		if l[j] is 'B':
			f = 1
			c += 1
			q = j + 1
			p = i + 1
	ls.append(l)
if c == 1:
	print(p, q)
else:
	m = c // 2
	q = q - m
	p = p + m
	print(p, q)


(n, m) = map(int, input().split())
(a, b) = (-1, -1)
for r in range(n):
	s = list(input())
	bid = [i for (i, x) in enumerate(s) if x == 'B']
	if len(bid) > 0:
		if a == -1:
			a = (r, bid[0])
		b = (r, bid[-1])
print((a[0] + b[0]) // 2 + 1, (a[1] + b[1]) // 2 + 1)


(n, m) = map(int, input().split())
(a, b) = (None, None)
for i in range(n):
	side = input()
	for k in range(m):
		if side[k] == 'B':
			a = k + 1
			break
	if a is not None:
		for k in range(m - 1, -1, -1):
			if side[k] == 'B':
				b = k + 1
				break
	if a is not None and b is not None:
		length = b - a
		print(i + 1 + length // 2, (b + a) // 2)
		break


(n, m) = (int(x) for x in input().split())
(m0, m1, n0, n1) = (0, 0, 116, 0)
b = 0
flag = True
for i in range(n):
	s = list(input())
	if 'B' in s:
		if flag:
			flag = False
			b = s.count('B')
			m0 = s.index('B')
			ansm = m0 + b // 2 + 1
		n0 = i
ansn = n0 - b // 2 + 1
print(ansn, ansm)


(n, m) = list(map(int, input().split()))
t = []
for i in range(n):
	x = input()
	t.append(x)
for i in range(n):
	for j in range(m):
		if t[i][j] == 'B':
			x = t[i].count('B')
			r = i + 1 + x // 2
			c = j + 1 + x // 2
			print(str(r) + ' ' + str(c))
			exit()


(n, m) = list(map(int, input().split()))
l = []
for i in range(n):
	l.append(input())
for i in range(n):
	count = 0
	start = -1
	entered = False
	for j in range(m):
		if l[i][j] == 'B':
			count += 1
			if start == -1:
				start = j + 1
			entered = True
	if entered:
		column = start + count // 2
		row = i + count // 2 + 1
		break
print(row, column)


(n, m) = map(int, input().split())
top = [-1, -1]
bottom = [-1, -1]
matrix = list()
for i in range(n):
	s = input()
	matrix.append(s)
for i in range(n):
	left = matrix[i].find('B')
	if left != -1:
		top[0] = i
		top[1] = left
		break
for i in range(n - 1, -1, -1):
	right = matrix[i].rfind('B')
	if right != -1:
		bottom[0] = i
		bottom[1] = right
		break
print(1 + top[0] + (bottom[0] - top[0]) // 2, 1 + top[1] + (bottom[1] - top[1]) // 2)


(nRows, nColumns) = map(int, input().split())
beg = -1
row = ''
height = 0
for i in range(0, nRows):
	row = input()
	found = row.count('B')
	if found and beg == -1:
		x0 = row.index('B')
		y0 = i
		width = found
		height += 1
		beg = i
	elif row.count('B'):
		height += 1
print(y0 + height // 2 + 1, x0 + width // 2 + 1)


(n, k) = [int(x) for x in input().split()]
l = []
for i in range(0, n):
	row = input()
	l.append(row)
count = int(0)
flag = int(0)
for i in range(0, n):
	for j in range(0, k):
		if l[i][j] == 'B':
			finalr = i
			finalc = j
			flag = int(1)
			if count == 0:
				inir = i
				inic = j
				count += 1
	if flag == 1:
		break
r = (finalc - inic) // 2
x = inir + r
y = inic + r
print(x + 1, y + 1)


(n, m) = [int(__) for __ in input().strip().split()]
mat = []
for _ in range(n):
	mat.append(list(input().strip()))
(x, y) = (0, 0)
found = False
for i in range(n):
	for j in range(m):
		if mat[i][j] == 'B':
			(x, y) = (i, j)
			found = True
			break
	if found:
		break
(xc, yc) = (0, 0)
for i in range(x, n):
	if mat[i][y] == 'B':
		xc += 1
	else:
		break
for j in range(y, m):
	if mat[x][j] == 'B':
		yc += 1
	else:
		break
print(x + xc // 2 + 1, y + yc // 2 + 1)


(n, m) = map(int, input().split())
e = []
for i in range(n):
	l = input()
	e.append(l)
t = []
for i in range(n):
	t1 = []
	for k in range(m):
		if e[i][k] == 'B':
			t1.append(k + 1)
	t.append(t1)
j = 1
w = []
for i in t:
	if len(i) != 0:
		r = len(i)
		r = list(i)
		w.append(j)
	j = j + 1
s = len(w) // 2
q = len(r) // 2
print(w[s], r[q])


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
firstocc = []
lastocc = []
count = 0
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B' and count == 0:
			firstocc.append(i + 1)
			firstocc.append(j + 1)
			count = -1
count = 0
for i in range(n - 1, -1, -1):
	for j in range(m - 1, -1, -1):
		if a[i][j] == 'B' and count == 0:
			lastocc.append(i + 1)
			lastocc.append(j + 1)
			count = -1
ans1 = (firstocc[0] + lastocc[0]) // 2
ans2 = (firstocc[1] + lastocc[1]) // 2
print(ans1, end=' ')
print(ans2)


def centerOfSquare(matrix):
	for i in range(len(matrix)):
		size = 0
		for j in range(len(matrix[0])):
			if matrix[i][j] == 'B':
				size += 1
			if size > 0 and (j == len(matrix[0]) - 1 or matrix[i][j + 1] != 'B'):
				return (i + 1 + size // 2, j + 1 - size // 2)
	return (0, 0)
(n, m) = map(int, input().split())
matrix = []
for _ in range(n):
	matrix.append(input())
(a, b) = centerOfSquare(matrix)
print(str(a) + ' ' + str(b))


import logging
fmt = '%(levelname)s - %(name)s (line:%(lineno)s) - %(message)s'
formatter = logging.Formatter(fmt)
ch = logging.StreamHandler()
ch.setLevel(logging.ERROR)
ch.setFormatter(formatter)
logger = logging.getLogger('find_square')
logger.setLevel(logging.ERROR)
logger.addHandler(ch)

def solve(table, n, m):
	if n == m == 1:
		return (1, 1)
	first = None
	second = None
	for (row, row_values) in enumerate(table):
		if second is not None:
			break
		for (col, value) in enumerate(row_values):
			if value == 'B' and first is None and (col + 1 != m):
				first = (row, col)
			elif value == 'B' and first is None and (col + 1 == m):
				first = second = (row, col)
			elif first is not None and value == 'W':
				second = (row, col - 1)
			elif first is not None and col + 1 == m:
				second = (row, col - 1)
			if second is not None:
				break
	last = None
	for row in range(first[0], n):
		row_values = table[row]
		if last is not None:
			break
		(col, value) = (first[1], table[row][first[1]])
		if value == 'W':
			last = (row - 1, col)
		elif row + 1 == n:
			last = (row, col)
	num_cols = second[1] - first[1] + 1
	num_rows = last[0] - first[0] + 1
	if num_rows > num_cols:
		second = (second[0], second[1] + (num_rows - num_cols))
	elif num_rows < num_cols:
		last = (last[0] - (num_cols - num_rows), last[1])
	center_row = (first[0] + 1 + last[0] + 1) // 2
	center_col = (first[1] + 1 + second[1] + 1) // 2
	return (center_row, center_col)

def main():
	(n, m) = map(int, input().strip().split())
	table = [list(input().strip()) for _ in range(n)]
	result = solve(table, n, m)
	print(' '.join(map(str, result)))
main()


(a, b) = map(int, input().split())
i = 0
k = 0
fl = 1
while i != a and k == 0:
	i += 1
	s = input()
	for j in range(len(s)):
		if s[j] == 'B':
			if fl == 1:
				l = j + 1
				fl = 0
			k += 1
		h = i
print(h + k // 2, l + k // 2)


(n, m) = map(int, input().split())
check = 0
for i in range(n):
	s = input()
	if check == 1:
		continue
	if 'B' in s:
		c = s.count('B')
		j = s.index('B')
		print(i + c // 2 + 1, j + c // 2 + 1)
		check = 1


(n, m) = map(int, input().split())
T = [[] for i in range(n)]
for i in range(n):
	a = list(input())
	T[i] = a
(h, w) = (0, 0)
flag = False
for i in range(n):
	if flag:
		break
	for j in range(m):
		if T[i][j] == 'B':
			k = 0
			while k + j < m and T[i][k + j] == 'B':
				k += 1
			w = k // 2 + j + 1
			l = 0
			while l + i < n and T[i + l][j] == 'B':
				l += 1
			h = l // 2 + i + 1
			flag = True
			break
print(h, w)


(r, c) = map(int, input().strip().split())
a = []
for i in range(r):
	a.append(input().strip())
left = -1
right = -1
up = -1
down = -1
for i in range(r):
	for j in range(c):
		if a[i][j] == 'B':
			if left < 0 and up < 0:
				left = j
				up = i
			if j == c - 1:
				right = j
			elif j < c - 1 and a[i][j + 1] == 'W':
				right = j
			if i == r - 1:
				down = i
			elif i < r - 1 and a[i + 1][j] == 'W':
				down = i
x = int((up + down) / 2)
y = int((left + right) / 2)
print(str(x + 1) + ' ' + str(y + 1))


(n, m) = map(int, input().split())
(x, y) = (-1, -1)
for i in range(n):
	s = input()
	if x == -1 and y == -1:
		d1 = s.find('B')
		d2 = s.rfind('B')
		if d1 != -1 and d2 != -1:
			x = (d2 - d1) // 2 + 1 + i
			y = (d2 - d1) // 2 + 1 + d1
			print(x, y)


def coordinates(x, n_cols):
	col = x % n_cols
	row = x // n_cols
	if col == 0:
		col = n_cols
	else:
		row += 1
	return (row, col)

def main():
	[n_rows, n_cols] = [int(_) for _ in input().split()]
	stones = ''
	for i in range(n_rows):
		stones += input()
	first = coordinates(stones.index('B') + 1, n_cols)
	last = coordinates(stones.rindex('B') + 1, n_cols)
	center = ((first[0] + last[0]) // 2, (first[1] + last[1]) // 2)
	print(' '.join([str(x) for x in center]))
main()


(n, m) = map(int, input().split())
for row in range(n):
	s = input()
	try:
		col = s.index('B')
		length = s.count('B')
	except:
		continue
	x = row + (length + 1) // 2
	y = col + (length + 1) // 2
	print(x, y)
	break


(N, M) = [int(x) for x in input().split()]
rows = []
for _ in range(N):
	A = input().split()
	rows.append(A)
flag = True
i = -1
jfinal = 0
while flag and i < N:
	i += 1
	j = 0
	while flag and j < M:
		if rows[i][0][j] == 'B':
			flag = False
			jfinal = j
		else:
			j += 1
flag = True
i += 1
jfinal += 1
avgr = i
avgc = jfinal
i = N
while flag and i >= 0:
	i -= 1
	j = M - 1
	while flag and j >= 0:
		if rows[i][0][j] == 'B':
			flag = False
			jfinal = j
		else:
			j -= 1
i += 1
jfinal += 1
avgr += i
avgc += jfinal
print(avgr // 2, avgc // 2)


(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


(r, c) = [int(x) for x in input().strip().split()]
board = [input().strip() for i in range(r)]
b = False
count = 1
start = None
for i in range(r):
	for j in range(c):
		if board[i][j] == 'B' and (not b):
			b = True
			start = (i, j)
		elif b and board[i][j] == 'B':
			count += 1
		elif b:
			l = count // 2 + 1
			print(str(start[0] + l) + ' ' + str(start[1] + l))
			exit()
	if b:
		l = count // 2 + 1
		print(str(start[0] + l) + ' ' + str(start[1] + l))
		exit()


(n, k) = map(int, input().split())
lis = []
pointer = -1
cr_lis = False
for i in range(n):
	s = input()
	for j in range(len(s)):
		if s[j] == 'B':
			if cr_lis:
				lis[pointer].append((i + 1, j + 1))
			else:
				cr_lis = True
				lis.append([])
				pointer += 1
				lis[pointer].append((i + 1, j + 1))
	cr_lis = False
n = len(lis)
k = len(lis[0])
ans = lis[n // 2][k // 2]
print(ans[0], ans[1])


(n, m) = map(int, input().split())
lista = [input() for _ in range(n)]
count = 0
index1 = 0
index2 = 0
for i in lista:
	if 'B' in i:
		count += 1
		index1 = lista.index(i)
for j in lista[index1]:
	if j == 'B':
		index2 = lista[index1].index(j)
		break
ci = index1 + count // 2 + 1
cj = index2 + count // 2 + 1
if n > 1 and m == 1:
	cj = 1
print(ci, cj)


def find_square(matrix, n, m):
	for i in range(n):
		for j in range(m):
			if matrix[i][j] == 'B':
				length = 1
				for x in range(j + 1, m):
					if matrix[i][x] == 'W':
						break
					length += 1
				return (i + length // 2 + 1, j + length // 2 + 1)
(n, m) = map(int, input().strip().split())
matrix = []
for _ in range(n):
	matrix.append(input().strip())
coord = find_square(matrix, n, m)
print(' '.join(map(str, coord)))


(n, m) = map(int, input().split())
middlerow = [0, 0]
middlecolumn = [0, 0]
foundrow = False
foundcolumn = False
for i in range(0, n):
	row = list(input())
	if foundrow == False:
		for j in range(0, m):
			if row[j] == 'B' and (not foundrow):
				middlecolumn[0] = j + 1
				middlecolumn[1] = j + 1
				middlerow[0] = i + 1
				middlerow[1] = i + 1
				foundrow = True
			elif row[j] == 'B':
				middlecolumn[1] = j + 1
	elif 'B' in row:
		middlerow[1] = i + 1
if middlerow[0] == middlerow[1]:
	resultrow = middlerow[0]
else:
	resultrow = (middlerow[1] + middlerow[0]) // 2
if middlecolumn[0] == middlecolumn[1]:
	resultcolumn = middlecolumn[0]
else:
	resultcolumn = (middlecolumn[1] + middlecolumn[0]) // 2
print(resultrow, resultcolumn)


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())

def find(n, m):
	for i in range(n):
		for j in range(m):
			if a[i][j] == 'B':
				return (i, j)
(x, y) = find(n, m)
(x2, y2) = (x, y)
while x2 < n:
	if a[x2][y] != 'B':
		break
	x2 += 1
while y2 < m:
	if a[x][y2] != 'B':
		break
	y2 += 1
print((x + x2) // 2 + 1, (y + y2) // 2 + 1)


(n, m) = input().split(' ')
n = int(n)
m = int(m)
imin = 1000
jmin = 1000
imax = 0
jmax = 0
for i in range(0, n):
	s = input()
	for j in range(0, m):
		if s[j] == 'B':
			if imin > i:
				imin = i
			if imax < i:
				imax = i
			if jmin > j:
				jmin = j
			if jmax < j:
				jmax = j
print((imin + imax) // 2 + 1, ' ', (jmin + jmax) // 2 + 1)


(n, m) = [int(x) for x in input().split()]
l_st = None
c_st = None
c_en = None
for line_index in range(n):
	line = [ch for ch in input()]
	for (column_index, ch) in enumerate(line):
		if ch == 'B':
			if l_st is None:
				l_st = line_index
			if c_st is None:
				c_st = column_index
			if l_st == line_index:
				c_en = column_index
center = 1 + (c_en - c_st) / 2
print(int(l_st + center), int(c_st + center))


(a, b) = map(int, input().split())
list1 = [input() for i in range(a)]
for i in range(len(list1)):
	if str(list1[i]).count('B') > 0:
		c = list1[i].count('B')
		print(i + c // 2 + 1, str(list1[i]).find('B') + c // 2 + 1)
		break


(n, m) = map(int, input().split())
l = []
s = 0
on = 1
for i in range(n):
	text = input()
	if not on and 'B' not in text:
		break
	if 'B' in text:
		l.append(text)
		on = 0
	if on:
		s += 1
if len(l) in {1, 2}:
	row_center = s + 1
else:
	row_center = s + 1 + len(l) // 2
if l[0].count('B') in {1, 2}:
	column_center = l[0].find('B') + 1
else:
	column_center = l[0].count('B') // 2 + l[0].find('B') + 1
print(row_center, ' ', column_center)


(n, m) = map(int, input().split())
a = []
b = []
sumx = 0
sumy = 0
for i in range(n):
	s = input()
	for j in range(len(s)):
		if s[j] == 'B':
			a.append(j)
			sumy += j
			b.append(i)
			sumx += i
x = sumx // len(b)
y = sumy // len(a)
print(x + 1, y + 1)


(n, m) = map(int, input().split())
M = []
for i in range(n):
	M += [input()]
(x1, y1, x2, y2) = (-1, -1, -1, -1)
for r in range(n):
	for c in range(m):
		if M[r][c] == 'B':
			if x1 == -1:
				(x1, y1) = (r, c)
			if x2 == -1:
				(x2, y2) = (r, c)
			x1 = min(x1, r)
			y1 = min(y1, c)
			x2 = max(x2, r)
			y2 = max(y2, c)
print((x1 + x2) // 2 + 1, end=' ')
print((y1 + y2) // 2 + 1, end=' ')


import time
(n, m) = (int(i) for i in input().split())
s = []
for i in range(n):
	s.append(input())
start = time.time()
flag = False
for i in range(n):
	for j in range(m):
		if s[i][j] == 'B':
			flag = True
			break
	if flag == True:
		break
k = j
while k < m:
	if s[i][k] == 'W':
		break
	k += 1
cx = i + (k - j) // 2 + 1
cy = j + (k - j) // 2 + 1
print(cx, cy)
finish = time.time()


(n, m) = map(int, input().split())
for i in range(n):
	cur = list(input())
	black = False
	first_black = 0
	for (j, el) in enumerate(cur):
		if el == 'W':
			if black:
				delta = (j - first_black) // 2 + 1
				print(i + delta, first_black + delta)
				break
		elif not black:
			first_black = j
			black = True
	else:
		if black:
			delta = (m - 1 - first_black) // 2 + 1
			print(i + delta, first_black + delta)
			break
		continue
	break


dummyBecausePythonDoNotCareAboutMatrixDimensionsAndInThisProblemDimensionsIsDummyAnyWay = input()
i = 0
while True:
	s = input()
	if 'B' in s:
		break
	i += 1
center = s.count('B') // 2 + 1
j = s.find('B')
print(i + center, j + center)


import sys

def main():
	pass

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

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	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
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

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

def iinp():
	return int(input())

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

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

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
(n, m) = nninp()
ans = 0
cnt = f = 0
for i in range(n):
	s = ssinp()
	r = stl(s)
	cnt = 0
	for c in range(len(r)):
		if r[c] == 'W' and f == 0:
			pass
		elif r[c] == 'B' and f == 0:
			cnt += 1
			f = 1
		elif r[c] == 'B' and f == 1:
			cnt += 1
		elif r[c] == 'W' and f == 1:
			f = 0
			if cnt % 2 == 1:
				print(i + 1 + cnt // 2, c - cnt // 2)
				exit()
	if cnt % 2 == 1:
		print(i + 1 + cnt // 2, c + 1 - cnt // 2)
		exit()


(n, m) = map(int, input().split())
a = []
for _ in range(n):
	a.append(input())
x = min(filter(lambda i: 'B' in a[i], range(n)))
y = max(filter(lambda i: 'B' in a[i], range(n)))
z = a[x].index('B')
d = (y - x + 2) // 2
print(x + d, z + d)


(a, b) = map(int, input().split())
k = []
for i in range(a):
	l = list(map(str, input()))
	k.append(l)
y = []
z = []
for row in range(a):
	for col in range(b):
		if k[row][col] == 'B':
			y.append(row)
			z.append(col)
Y = sum(y) / len(y)
Z = sum(z) / len(z)
print(int(Y) + 1, int(Z) + 1)


(a, b) = map(int, input().split())
x = []
getit = False
for i in range(1, a + 1):
	s = input()
	if getit:
		continue
	left = s.find('B')
	if left > -1:
		if len(x) == 0:
			right = s.rindex('B')
			x.append((right - left) / 2 + i)
			x.append((left + right) / 2 + 1)
print(int(x[0]), int(x[1]))


import sys
import math
(r, c) = map(int, input().split())
a = [input() for y in range(r)]
for i in range(len(a)):
	x1 = i
	try:
		(x2, y2) = (a[i].index('B'), a[i].rindex('B'))
	except:
		continue
	y1 = x1 + (y2 - x2)
	print(int((x1 + y1) / 2) + 1, int((x2 + y2) / 2) + 1)
	break


(a, b) = map(int, input().split())
l = []
r = ''
o = []
i = 0
for k in range(0, a):
	s = str(input())
	i = i + 1
	if 'B' in s and r == '':
		r = s
	if 'B' in s:
		l.append(i)
for i in range(0, b):
	if r[i] == 'B':
		o.append(i + 1)
print(int((l[0] + l[-1]) / 2), int((o[0] + o[-1]) / 2))


def prettyPrint(len, firstRow, lastCol):
	halfLen = len // 2
	colC = lastCol - halfLen
	rowC = firstRow + halfLen
	print(rowC + 1, colC + 1)

def main():
	line = input().split(' ')
	n = int(line[0])
	m = int(line[1])
	for r in range(n):
		mess = list(input())
		first = -1
		for c in range(m):
			sym = mess[c]
			if sym == 'B' and first == -1:
				first = c
			if sym == 'W' and first != -1:
				prettyPrint(c - first, r, c - 1)
				return
		if first != -1:
			prettyPrint(m - first, r, m - 1)
			return
main()


(n, m) = [int(j) for j in input().split()]
a = [[] for j in range(n)]
for i in range(n):
	a[i] = list(input())
(s, e, c) = (-1, -1, -1)
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B' and s == -1:
			s = j
		if a[i][j] == 'B':
			e = j
	if e != -1:
		c = i
		break
p = e - s + 1
x = c + p // 2 + 1
y = s + p // 2 + 1
print(x, y)


def main():
	(n, m) = map(int, input().split())
	sumc = 0
	sumr = 0
	l = 0
	for i in range(n):
		s = input()
		if 'B' in s:
			l = 0
			sumc += i
			for j in range(len(s)):
				if s[j] == 'B':
					l += 1
					sumr += j
	print(sumc // l + 1, sumr // (l * l) + 1)
main()


(n, m) = map(int, input().split())
topleft = [-1, -1]
topright = [-1, -1]
bottomleft = [-1, -1]
bottomright = [-1, -1]
for i in range(0, n):
	column = input()
	for j in range(0, m):
		if column[j] == 'B':
			if topleft[0] == -1:
				topleft[0] = i
				topright[0] = i
				topleft[1] = j
				topright[1] = j
				bottomleft[0] = i
				bottomleft[1] = j
				bottomright[0] = i
				bottomright[1] = j
			else:
				bottomleft[0] = i
				bottomright[0] = i
				bottomright[1] = j
				topright[1] = j
print(topleft[0] + (bottomright[0] - topleft[0]) // 2 + 1)
print(bottomleft[1] + (bottomright[1] - topleft[1]) // 2 + 1)


(n, m) = [int(s) for s in input().split(' ')]
rows = []
for i in range(n):
	s = input()
	if 'B' in s:
		rows.append(i)
		y = s.index('B') + s.count('B') // 2 + 1
x = (rows[0] + rows[-1]) // 2 + 1
print(x, y)


(a, b) = input().split(' ')
x = 0
f = []
for i in range(0, int(a)):
	s = input()
	if 'B' in s:
		c = []
		f.append(i)
		for j in range(0, int(b)):
			p = []
			if s[j] == 'B':
				x = x + 1
				c.append(j)
g = c[0] + len(c) // 2 + 1
r = f[0] + len(f) // 2 + 1
print(str(r) + ' ' + str(g))


(n, m) = map(int, input().split())
(x, y) = (0, 0)
for i in range(n):
	line = input()
	if x != 0:
		continue
	try:
		j = line.index('B')
		x = (j + len(line) - line[::-1].index('B')) // 2 + 1
		y = i + x - j
	except ValueError:
		pass
print('{} {}'.format(y, x))


def go():
	(n, m) = [int(i) for i in input().split(' ')]
	a = []
	for i in range(n):
		a.append([i for i in input()])
	start = None
	end = None
	for i in range(n):
		for j in range(m):
			if a[i][j] == 'B':
				if start is None:
					start = (i, j)
				end = (i, j)
				break
	x = (start[0] + 1 + end[0] + 1) // 2
	y = start[1] + x - start[0]
	return '{} {}'.format(x, y)
print(go())


(r, c) = map(int, input().split())
x = -1
(mini, maxi) = (10000000000.0, -10000000000.0)
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)


(n, m) = map(int, input().split())
(p, q, c) = (0, 0, 0)
for i in range(n):
	v = input()
	for j in range(m):
		if v[j] == 'B':
			p += i
			q += j
			c += 1
print(p // c + 1, q // c + 1)


from math import *
s = [int(n) for n in input().split()]
z = []
p = []
a = 0
b = 0
for n in range(s[0]):
	z.append([k for k in input()])
	if 'B' in z[n]:
		p.append(1)
	else:
		p.append(0)
	if 'B' in z[n]:
		a = z[n].index('B')
		b = s[1] - 1 - z[n][::-1].index('B')
x = ceil((a + b) / 2)
g = p.index(1)
h = s[0] - 1 - p[::-1].index(1)
y = ceil((g + h) / 2)
print(1 + y, x + 1)


from math import ceil as c
(n, m) = map(int, input().split())
s_str = None
end_str = None
s_col = None
end_col = None
for i in range(n):
	s = input()
	for (j, v) in enumerate(s):
		if v == 'B':
			if s_str == None:
				s_str = i + 1
				s_col = j + 1
			end_col = j + 1
			end_str = i + 1
print(c((end_str + s_str) / 2), c((end_col + s_col) / 2))


(n, m) = map(int, input().split())
maxX = -1
maxY = -1
minY = 99999
minX = 99999
a = []
for i in range(n):
	buf = list(input())
	a.append(buf)
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B':
			maxX = max(maxX, i)
			minX = min(minX, i)
			minY = min(minY, j)
			maxY = max(maxY, j)
X = (maxX + minX) // 2 + 1
Y = (maxY + minY) // 2 + 1
print(X, Y)


from sys import exit
(n, m) = map(int, input().split())
u = []
for i in range(n):
	u.append(list(input()))
for i in range(n):
	for j in range(m):
		if u[i][j] == 'B':
			a = i
			b = j
			while a < n and u[a][j] == 'B':
				a += 1
			print(i + (a - i) // 2 + 1, end=' ')
			while b < m and u[i][b] == 'B':
				b += 1
			print(j + (b - j) // 2 + 1)
			exit()


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


import sys
(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	fst = s.find('B')
	if fst != -1:
		snd = s.rfind('B')
		halflen = (snd - fst) // 2
		print(i + halflen + 1, fst + halflen + 1)
		sys.exit(0)


(n, m) = input().split()
n = int(n)
for i in range(1, n + 1):
	s = input()
	t = s.find('B') + 1
	if t != 0:
		tt = s.rfind('B') + 1
		ttt = (tt + t) // 2
		print(i + ttt - t, ttt)
		break


(n, m) = map(int, input().split())
(x, y) = (0, 0)
for i in range(n):
	s = list(input())
	if 'B' in s:
		x = i + s.count('B') // 2 + 1
		y = 1
		for el in s:
			if el != 'B':
				y += 1
			else:
				break
		y += s.count('B') // 2
		print(x, y)
		exit(0)


(n, m) = map(int, input().split())
k = -1
j = -1
x = -1
f = 0
for i in range(n):
	a = input()
	if f == 0:
		for k in range(m):
			if a[k] == 'B':
				x = i + 1
				k = k + 1
				f = 1
				break
		a = a[::-1]
		for j in range(m):
			if a[j] == 'B':
				j = m - j
				break
print(x + int((j - k) / 2), int((k + j) / 2))


(n, m) = map(int, input().split())
sl = []
for i in range(n):
	sl += [input()]
x1 = 0
x2 = 0
z1 = 0
z2 = 0
tmp = 0
p = 0
t = 0
for i in range(n):
	for j in range(m):
		if sl[i][j] == 'B' and tmp == 0:
			x1 = j + 1
			t = i
			tmp = 1
			for k in range(j, m):
				if sl[i][k] == 'B':
					x2 = k + 1
				if sl[i][k] != 'B':
					break
		if tmp == 1:
			break
	if tmp == 1:
		break
tmp = 0
for i in range(t, n):
	if sl[i][x1 - 1] == 'B' and sl[i][x2 - 1] == 'B':
		if tmp == 0:
			z1 = i + 1
			z2 = i + 1
			tmp = 1
		else:
			z2 = i + 1
		continue
	else:
		break
print((z2 + z1) // 2, (x2 + x1) // 2)


import sys
(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	fl = 0
	k = 0
	z = 0
	for j in range(m):
		if s[j] == 'B' and fl == 1:
			k += 1
			z = j
		if s[j] == 'B' and fl == 0:
			fl = 1
			k = 1
			z = j
	if fl == 1:
		print(i + k // 2 + 1, z - k // 2 + 1)
		sys.exit()


(n, m) = map(int, input().split())
ls = [input() for i in range(n)]
x = []
y = []
for i in range(n):
	for j in range(m):
		if ls[i][j] == 'B':
			x.append(i + 1)
			y.append(j + 1)
print(sum(x) // len(x), sum(y) // len(y))


(n, m) = map(int, input().split())
li = [[j for j in input()] for i in range(n)]
position1 = 0
position2 = 0
position3 = 0
position4 = 0
for j in range(m):
	flag = False
	for i in range(n):
		if li[i][j] == 'B':
			flag = True
			position1 = i
			break
	if flag == True:
		break
for j in range(m - 1, -1, -1):
	flag = False
	for i in range(n - 1, -1, -1):
		if li[i][j] == 'B':
			flag = True
			position2 = i
			break
	if flag == True:
		break
for i in range(n):
	flag = False
	for j in range(m):
		if li[i][j] == 'B':
			flag = True
			position3 = j
			break
	if flag == True:
		break
for i in range(n - 1, -1, -1):
	flag = False
	for j in range(m - 1, -1, -1):
		if li[i][j] == 'B':
			flag = True
			position4 = j
			break
	if flag == True:
		break
avg1 = (position1 + position2) // 2 + 1
avg2 = (position3 + position4) // 2 + 1
print(avg1, avg2)


(n, m) = map(int, input().split())
(ans, ans1, ans2) = ([], [], [])
for i in range(n):
	l = list(input())
	ans.append(l)
for i in range(m):
	for j in range(n):
		if ans[j][i] == 'B' and j + 1 not in ans1:
			ans1.append(j + 1)
for i in range(n):
	for j in range(m):
		if ans[i][j] == 'B' and j + 1 not in ans2:
			ans2.append(j + 1)
print(ans1[len(ans1) // 2], ans2[len(ans2) // 2])


(n, m) = map(int, input().split())
for i in range(n):
	a = str(input())
	if 'B' in a:
		s = a.count('B')
		for j in range(m):
			if a[j] == 'B':
				break
		break
print((2 * i + s + 1) // 2, (2 * j + 1 + s) // 2)


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

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

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

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

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

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

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

def S():
	return input()

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

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	(n, m) = LI()
	aa = [S() for _ in range(n)]
	t = 0
	r = 0
	c = 0
	for i in range(n):
		ai = aa[i]
		for j in range(m):
			if ai[j] == 'B':
				t += 1
				r += i
				c += j
	return '{} {}'.format(r // t + 1, c // t + 1)
print(main())


import math
(n, m) = map(int, input().split())
s = ''
for i in range(n):
	s += str(input())
l = (s.find('B') + s.rfind('B') + 2) // 2
print(math.ceil(l / m), l - (math.ceil(l / m) - 1) * m, sep=' ')


ip = input()
ip = ip.split()
rows = int(ip[0])
cols = int(ip[1])
r = 1
j = 1
done = False
found = False
reqd = ''
for i in range(1, rows + 1, 1):
	ip = input()
	if 'B' in ip and (not done):
		reqd = ip
		r = i
		done = True
for i in range(0, len(reqd)):
	if reqd[i] == 'B':
		co = i + 1
		break
num = reqd.count('B')
print(str(r + num // 2) + ' ' + str(co + num // 2))


(a, b) = map(int, input().split())
lst = ''
c = True
x = 0
y = 0
cnt = 0
for i in range(a):
	ar = input()
	lst += ar
	if 'B' in ar:
		if c:
			x = i + 1
			y = ar.find('B') + 1
			c = False
		cnt += 1
print(x + cnt // 2, y + cnt // 2)


(n, m) = map(int, input().split())
first = ()
last = ()
for i in range(n):
	row = input()
	for j in range(m):
		if row[j] == 'B':
			if first == ():
				first = (i, j)
			last = (i, j)
print((first[0] + last[0]) // 2 + 1, (first[1] + last[1]) // 2 + 1)


p = 0
z = 0
(r, c) = (0, 0)
a = []
(n, m) = map(int, input().split())
for i in range(n):
	a.append(input())
for i in range(n):
	for k in range(m):
		if a[i][k] == 'B':
			p = 1
			for x in range(k, m):
				if a[i][x] == 'B':
					z += 1
			r = int(i + 1 + (z - 1) / 2)
			c = int(k + 1 + (z - 1) / 2)
			break
	if p == 1:
		break
print(r, c)


(n, m) = map(int, input().split())
counter = 0
flag = 0
row = -1
column = -1
t = []
for i in range(n):
	t.append(input())
for i in range(n):
	for j in range(m):
		if t[i][j] == 'B':
			flag = 1
			counter += 1
			if column == -1:
				column = j
			if row == -1:
				row = i
	if flag == 1:
		break
column += counter // 2
row += counter // 2
print(row + 1, column + 1)


(n, m) = map(int, input().split())
A = [list(input()) for i in range(n)]
l = 0
s_r = 0
s_c = 0
k = False
for i in range(n):
	for j in range(m):
		if A[i][j] == 'B':
			if not k:
				s_r = i
				s_c = j
			k = True
			l += 1
	if k:
		break
print(s_r + l // 2 + 1, s_c + l // 2 + 1)


(n, m) = map(int, input().split())
for i in range(n):
	A = input()
	if 'B' in A:
		p = A.find('B') + 1
		l = A.count('B')
		print(i + 1 + (l - 1) // 2, p + (l - 1) // 2)
		exit()


def check(n, m, arr):
	for i in range(n):
		for j in range(m):
			if arr[i][j] == 'B':
				flagi_r = i
				flagi_c = j
				return (flagi_r, flagi_c)

def row_end(n, m, r_i, c_i, arr):
	for i in range(r_i, n + 1):
		t = arr[i]
		if t[c_i] == 'W' or t[c_i] == '#':
			return i - 1

def column_end(n, m, r_i, c_i, arr):
	for i in range(c_i, m + 1):
		t = arr[r_i]
		if t[i] == 'W' or t[i] == '#':
			return i - 1
(n, m) = map(int, input().split())
arr = []
for i in range(n):
	t = input()
	t += '#'
	arr.append(t)
arr.append('#' * m)
(r_i, c_i) = check(n, m, arr)
r_e = row_end(n, m, r_i, c_i, arr)
c_e = column_end(n, m, r_i, c_i, arr)
r = r_i + int((r_e - r_i) / 2) + 1
c = c_i + int((c_e - c_i) / 2) + 1
print(r, c)


(n, m) = map(int, input().split())
x = []
y = []
cnt = 0
for i in range(1, n + 1):
	s1 = input()
	for j in range(m):
		if s1[j] == 'B':
			x.append(i)
			y.append(j + 1)
			cnt = cnt + 1
print(*[sum(x) // cnt, sum(y) // cnt])


from math import *
(n, m) = map(int, input().split())
li = [[j for j in input()] for i in range(n)]
min1 = inf
min2 = inf
max1 = -inf
max2 = -inf
for i in range(n):
	for j in range(m):
		if li[i][j] == 'B':
			min1 = min(min1, i)
			min2 = min(min2, j)
			max1 = max(max1, i)
			max2 = max(max2, j)
print((min1 + max1) // 2 + 1, (min2 + max2) // 2 + 1)


M = lambda : list(map(int, input().split()))
(n, m) = M()
d = []
row = 1
for i in range(0, n):
	b = input()
	col = b.find('B')
	if col != -1:
		num_B = b.count('B') // 2
		col = col + 1 + num_B
		row = row + num_B
		break
	row += 1
print(row, col)


(a, b) = map(int, input().split())
for j in range(a):
	x = input()
	if x.count('B') > 0:
		index = x.find('B')
		cout = x.count('B')
		print(j + cout // 2 + 1, index + cout // 2 + 1)
		break


(n, m) = map(int, input().split())
sq_len = 0
cx = 0
cy = 0
for i in range(n):
	new = input()
	if sq_len == 0:
		sq_len = new.count('B')
		if sq_len != 0:
			cx = new.index('B') + sq_len // 2 + 1
			cy = i + sq_len // 2 + 1
print(cy, cx)


(n, m) = [int(x) for x in input().split()]
(x1, x2) = (0, 0)
s = ''
for i in range(n):
	row = input()
	if 'B' in row and x1 == 0:
		s = row
		x1 = i + 1
		x2 = i + 1
	elif 'B' in row and x1 != 0:
		x2 += 1
	elif x1 != 0 and x2 != 0 and ('B' not in row):
		pass
b = [ind + 1 for (ind, x) in enumerate(s) if x == 'B']
x = (x2 - x1) // 2 + x1
y = b[int(len(b) / 2)]
print(x, y)


(n, m) = input().split(' ')
n = int(n)
m = int(m)
a = []
for i in range(0, n):
	val = input()
	a.append(val)
minn = maxx = -1
flag = True
for (index, i) in enumerate(a):
	if 'B' in i:
		if flag:
			minn = index
			flag = False
		else:
			maxx = index
if maxx == -1:
	maxx = minn
mincol = a[minn].find('B')
maxcol = a[minn].rfind('B')
print(int((minn + maxx) / 2) + 1, int((mincol + maxcol) / 2) + 1)


(n, m) = map(int, input().split())
for j in range(n):
	st = input() + ' '
	c = 0
	d = 0
	for i in range(m):
		if st[i] == 'B' and d == 0:
			d = i + 1
		if st[i] == 'B':
			c += 1
	if c > 0:
		break
colm = int(d + c / 2)
row = j + 1 + int(c / 2)
print(row, colm)


(n, m) = (int(i) for i in input().split())
a = [j for i in range(n) for j in list(str(input()))]
s = 0
for i in a:
	if i == 'B':
		s += 1
t = 0
for i in range(m * n):
	if a[i] == 'B':
		t += 1
	if t == (s + 1) // 2:
		print(i // m + 1, i % m + 1)
		break


a = int(input().split()[0])
z = []
for i in range(a):
	z.append(list(input()))
for j in z:
	if 'B' in j:
		y = j.count('B') // 2 + z.index(j)
		x = j.index('B') + j.count('B') // 2
		break
print(y + 1, x + 1)


import math
(n, m) = map(int, input().split())
(list, cnt) = ([], 0)
for i in range(n):
	s = input()
	list.append(s)
	cnt += s.count('B')
ind = int(math.sqrt(cnt))
for i in range(n):
	for j in range(m):
		if list[i][j] == 'B':
			print(i + int(ind / 2) + 1, j + int(ind / 2) + 1)
			exit()


import math
(n, m) = [int(x) for x in input().split()]
rect = [input() for _ in range(n)]
done = False
for r in range(n):
	for c in range(m):
		t = rect[r][c]
		if t == 'B':
			start = c
			while c < m and rect[r][c] == 'B':
				c += 1
			end = c
			sq_len = end - start + 1
			ans = (r + sq_len // 2, start + sq_len // 2)
			done = True
			break
	if done:
		break
print(' '.join([str(i) for i in ans]))


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


(n, m) = map(int, input().split())
start = 0
black = 0
for i in range(n):
	s = input()
	if black:
		continue
	for j in range(m):
		if s[j] == 'B':
			if not black:
				start = j
			black += 1
	if black:
		print(i + 1 + black // 2, start + 1 + black // 2)


(n, m) = map(int, input().split())
st = [[] for i in range(n)]
for i in range(n):
	st[i] = input()
st1 = -1
st2 = -1
for i in range(0, n):
	for j in range(0, m):
		if st[i][j] == 'B':
			st1 = i
			st2 = j
			break
	if st1 != -1:
		break
j = st2
co = 0
while j < m and st[st1][j] == 'B':
	co += 1
	j += 1
st1 = st1 + co // 2
st2 = st2 + co // 2
print(st1 + 1, st2 + 1)


(n, m) = map(int, input().split())
l = []
k = []
for _ in range(n):
	l.append(input())
for i in range(n):
	g = []
	for j in range(m):
		if l[i][j] == 'B':
			g.append((i + 1, j + 1))
	if len(g) != 0:
		k.append(g)
print(*k[len(k) // 2][len(k) // 2])


(n, m) = map(int, input().split())
p = int()
q = int()
t = int(0)
for i in range(n):
	text = input()
	if t > 0:
		continue
	j = 0
	for letter in text:
		if letter == 'B':
			t = t + 1
			q = j
		j += 1
	if t > 0:
		t = t // 2
		q = q - t + 1
		p = i + t + 1
		t = 1
print(p, q)


a = list(input().split(' '))
(n, m) = (int(a[0]), int(a[1]))
a = []
for _ in range(n):
	a.append(list(input()))
x = 0
(x_begin, y_begin) = (-1, -1)
for i in range(n):
	res = 0
	for j in range(m):
		if a[i][j] == 'B':
			if y_begin == -1:
				y_begin = j
			res += 1
	if x == 0:
		x = max(x, res)
for j in range(m):
	for i in range(n):
		if a[i][j] == 'B':
			if x_begin == -1:
				x_begin = i
print(x_begin + x // 2 + 1, y_begin + x // 2 + 1)


(n, m) = map(int, input().split())
mat = [list(input()) for _ in range(n)]
h = [i for i in range(n) if 'B' in mat[i]]
v = [j for j in range(m) if mat[h[0]][j] == 'B']
print(h[0] + 1 + (h[-1] - h[0]) // 2, v[0] + 1 + (v[-1] - v[0]) // 2)


(n, m) = map(int, input().split())
c = []
for i in range(n):
	a = input()
	if 'B' in a:
		c.append(i)
		x = a.find('B')
		y = ''.join(a).rindex('B')
q = (x + y) // 2 + 1
r = (c[0] + c[-1]) // 2
print(r + 1, q)


(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	if 'B' in s:
		w = s.count('B')
		c = int((w + 1) / 2) + s.find('B')
		r = int((w + 1) / 2) + i
		print(r, c)
		exit(0)


(n, m) = map(int, input().split())
j0 = -1
i0 = -1
for i in range(n):
	s = input()
	if j0 >= 0:
		continue
	j0 = s.find('B')
	if j0 >= 0:
		size = s.rfind('B') - j0 + 1
		i0 = i
size //= 2
print(i0 + size + 1, j0 + size + 1)


(n, m) = map(int, input().split())
for fx in range(1, n + 1):
	s = input()
	c = s.count('B')
	if c > 0:
		break
fy = s.index('B') + 1
print(fx + int(c / 2), fy + int(c / 2))


(n, m) = input().split(' ')
n = int(n)
m = int(m)
a = []
b = []
for i in range(n):
	inp = input()
	if 'B' in inp:
		b.append(i + 1)
		for j in range(m):
			if inp[j] == 'B':
				a.append(j + 1)
r = b[len(b) // 2]
c = a[len(a) // 2]
print(str(r) + ' ' + str(c))


(n, m) = map(int, input().split())
tab = [input() for _ in range(n)]
(x, y) = ([False, 0, 0], [0, 0])
for i in range(n):
	for j in range(m):
		if tab[i][j] == 'B':
			if not x[0]:
				x[0] = True
				x[1] = i
				x[2] = j
			y[0] = i
			y[1] = j
print(x[1] + (y[0] - x[1]) // 2 + 1, x[2] + (y[1] - x[2]) // 2 + 1)


def square(arr):
	for (n, i) in enumerate(arr):
		if 'B' in i:
			left = i.index('B')
			right = i.rindex('B')
			dim = right - left + 1
			col = left + dim // 2 + 1
			row = n + dim // 2 + 1
			return [row, col]
(n, m) = list(map(int, input().split()))
arr = []
for i in range(n):
	arr.append(input())
print(*square(arr))


(n, m) = [int(x) for x in input().split()]
f = True
for iter in range(n):
	s = [x for x in input()]
	if f and 'B' in s:
		y = iter + 1
		min_ = float('inf')
		max_ = float('-inf')
		for (i, val) in enumerate(s):
			if val == 'B':
				min_ = min(i, min_)
				max_ = max(i, max_)
		ans = (min_ + max_) / 2
		size = max_ - min_
		f = False
print(int(y + size / 2), int(ans) + 1)


z = []
t = 0
flag = 0
r = 0
(x, y) = map(int, input().split())
for i in range(x):
	z.append(input())
for j in range(len(z)):
	for k in range(y):
		if z[j][k] == 'B':
			t = t + 1
		elif z[j][k] == 'W' and t != 0:
			flag = 1
			k = k - 1
			break
		if k == len(z[j]) - 1 and t != 0:
			flag = 1
			break
	if flag == 1:
		break
print(j + int((t - 1) / 2) + 1, k - int((t - 3) / 2))


(n, m) = (int(x) for x in input().split())
begin = end = string = -1
for i in range(n):
	s = input()
	if string == -1:
		for j in range(m):
			if s[j] == 'B' and begin == -1:
				begin = j
				string = i
			if s[j] == 'B':
				end = j
print(string + (end - begin) // 2 + 1, begin + 1 + (end - begin) // 2)


(n, m) = map(int, input().split())
l = []
for i in range(n):
	a = list(input())
	if 'B' in a:
		l.append(a)
		break
	else:
		l.append(a)
k = l[-1].count('B')
a = len(l) + k // 2
print(a, end=' ')
c = 0
for i in l[-1]:
	c += 1
	if i == 'B':
		break
print(c + k // 2)


(n, m) = map(int, input().split())
ls = []
for i in range(n):
	ls.append(list(input()))
index = []
col = 0
for i in range(len(ls)):
	try:
		col = ls[i].index('B')
		index.append(i)
	except:
		pass
row = (max(index) + min(index)) // 2
column = col + (max(index) - min(index)) // 2
print(row + 1, column + 1)


(n, m) = map(int, input().split(' '))
a = []
for i in range(n):
	a.append(input())
(p, q, r, s) = ('', '', '', '')
count = 0
for i in range(n):
	if a[i].find('B') != -1 and count == 0:
		p = [i, a[i].find('B')]
		q = [i, m - a[i][::-1].find('B') - 1]
		count = 1
	if a[i].find('B') != -1 and count == 1:
		r = [i, a[i].find('B')]
		s = [i, m - a[i][::-1].find('B') - 1]
print((p[0] + q[0] + r[0] + s[0]) // 4 + 1, (p[1] + q[1] + r[1] + s[1]) // 4 + 1)


(n, m) = map(int, input().split())
a = []
for i in range(1, n + 1):
	a.append(input())
for i in range(0, n):
	if 'B' in a[i]:
		u = i + 1
		break
for i in range(n - 1, -1, -1):
	if 'B' in a[i]:
		d = i + 1
		break
for i in range(0, m):
	if 'B' == a[(u + d) // 2 - 1][i]:
		l = i + 1
		break
for i in range(m - 1, -1, -1):
	if 'B' == a[(u + d) // 2 - 1][i]:
		r = i + 1
		break
print((u + d) // 2, (l + r) // 2)


(n, m) = map(int, input().split())
L = []
for i in range(n):
	L.append(input())
c = 0
(i, j) = (0, 0)
while i < n:
	c = L[i].count('B')
	if c > 0:
		break
	i += 1
print(i + 1 + c // 2, L[i].index('B') + 1 + c // 2)


from sys import stdin, stdout
mod = 10 ** 9 + 7
mod1 = mod - 1

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (modinv(fact[r], p) % p) * (modinv(fact[n - r], p) % p) % p
	return t

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def BS(arr, l, r, x):
	if r >= l:
		mid = l + (r - l) / 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return BS(arr, l, mid - 1, x)
		else:
			return BS(arr, mid + 1, r, x)
	else:
		n - 1
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import math
import heapq
from random import randint as rn

def comp(x, y):
	if x[0] < y[0]:
		return -1
	elif x[0] == y[0]:
		if x[1] < y[1]:
			return -1
		else:
			return 1
	else:
		return 1

def sum1(a, k):
	w = k - a
	q = 2 * k - (w - 1)
	q *= w
	q /= 2
	return q
(n, m) = map(int, input().split())
w = []
for i in range(n):
	w.append(input())
k = 0
for i in range(n):
	t = 0
	for j in range(m):
		if w[i][j] == 'B':
			p = 1
			t = 1
			while j + p < m and w[i][j + p] != 'W':
				p += 1
			y = j + (p + 1) // 2
			x = i + (p + 1) // 2
			k = 1
			break
	if k == 1:
		break
print(x, y)


(n, m) = map(int, input().split())
mat = [[input()] for i in range(n)]
for i in range(n):
	if 'B' in str(mat[i]):
		t = i
		break
u = 0
for i in range(n):
	if 'B' in str(mat[i]):
		u += 1
l = str(mat[t])
s = l.index('B') - 2
v = 0
for i in range(m + 4):
	if l[i] == 'B':
		v = v + 1
print(int(t + (u + 1) / 2), int(s + (v + 1) / 2))


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


def main():
	(n, m) = map(int, input().split())
	for i in range(n):
		l = input().split('B')
		if len(l) > 1:
			print(i + len(l) // 2, len(l[0]) + len(l) // 2)
			break
main()


(n, m) = [int(x) for x in input().split(' ')]
a = [list(input()) for i in range(n)]
(l, r, b, t) = (None, None, None, None)
for i in range(n):
	if 'B' not in a[i]:
		continue
	l = a[i].index('B')
	t = i
	break
(i, j) = (t, l)
while i < n and a[i][l] == 'B':
	i += 1
while j < m and a[t][j] == 'B':
	j += 1
(b, r) = (i, j)
print((t + b) // 2 + 1, (l + r) // 2 + 1)


from math import *
(x, y) = input().split()
x = int(x)
y = int(y)
s = []
for i in range(x):
	s.append(input())
for i in range(x):
	for j in range(y):
		if s[i][j] == 'B':
			a = [i, j]
			break
for i in range(x):
	for j in range(y):
		if s[x - 1 - i][y - 1 - j] == 'B':
			b = [x - 1 - i, y - 1 - j]
			break
aa = int((int(a[0]) + int(b[0])) / 2)
bb = int((int(a[1]) + int(b[1])) / 2)
print(aa + 1, bb + 1)


(n, m) = map(int, input().split(' '))
table = ['' for i in range(n)]
for i in range(n):
	table[i] = input().strip()
count = 0
isnotB = True
while isnotB:
	col = count % m
	row = count // m
	if table[row][col] == 'B':
		isnotB = False
	count += 1
count -= 1
col1 = count % m
row1 = count // m
count = m * n - 1
isnotB = True
while isnotB:
	col = count % m
	row = count // m
	if table[row][col] == 'B':
		isnotB = False
	count -= 1
count += 1
col2 = count % m
row2 = count // m
colcenter = int((col1 + col2) / 2) + 1
rowcenter = int((row1 + row2) / 2) + 1
print(str(rowcenter) + ' ' + str(colcenter))


(n, m) = map(int, input().split())
nel = []
for i in range(n):
	nel.append(input())
for i in range(n):
	if 'B' in nel[i]:
		coun = nel[i].count('B')
		indx = nel[i].index('B')
		break
r = i + coun // 2
c = indx + coun // 2
print(r + 1, c + 1)


(n, f) = map(int, input().split())
k = []
b = 0
ans = 0
m = False
for i in range(n):
	k.append(input())
	b += k[i].count('B')
b = (b + 1) // 2
for i in range(n):
	for j in range(f):
		if k[i][j] == 'B':
			ans += 1
		if ans == b:
			print(i + 1, j + 1)
			m = True
			break
	if m:
		break


(n, m) = map(int, input().split())
c = 0
a = 1
for i in range(n):
	s = input()
	if s.find('B') != -1:
		break
	a += 1
for i in range(m):
	if s[i] == 'B':
		c += 1
		r = i + 1
		l = r - c + 1
		x = (r - l) // 2
		y = a + x
		x = x + l
print(str(y) + ' ' + str(x))


(n, m) = map(int, input().split())
for r in range(1, n + 1):
	row = input()
	if 'B' in row:
		l = row.count('B') // 2
		i = row.index('B')
		break
print('%s %s' % (r + l, i + 1 + l))


(m, n) = [int(x) for x in input().split()]
j = None
for (i, x) in enumerate(range(m)):
	s = input()
	if j is None and 'B' in s:
		j = i
		l = s.find('B') + 1
		r = s.rfind('B') + 1
print(j + (r - l) // 2 + 1, (l + r) // 2)


(n, m) = map(int, input().split())
s = [input() for i in range(n)]
cnt = 0
(fx, fy, lx, ly) = (-1, -1, -1, -1)
for i in range(n):
	for j in range(m):
		if s[i][j] == 'B':
			if cnt == 0:
				(fx, fy) = (i + 1, j + 1)
				cnt += 1
			(lx, ly) = (i + 1, j + 1)
print((fx + lx) // 2, (fy + ly) // 2)


(n, m) = map(int, input().split())
for i in range(n):
	line = input()
	c = line.count('B')
	j = line.find('B')
	if j != -1:
		print('{} {}'.format(i + c // 2 + 1, j + c // 2 + 1))
		break


(n, m) = map(int, input().split())
for i in range(n):
	word = input()
	if 'B' in word:
		length = word.rfind('B') - word.find('B')
		print(i + length // 2 + 1, word.find('B') + length // 2 + 1)
		break


(n, m) = map(int, input().split())
l1 = []
for i in range(n):
	l1.append(input())
minx = miny = 99999999999
maxx = maxy = -99999999999
for i in range(n):
	for j in range(m):
		if l1[i][j] == 'B':
			minx = min(minx, i)
			miny = min(miny, j)
			maxx = max(maxx, i)
			maxy = max(maxy, j)
print((minx + maxx) // 2 + 1, end=' ')
print((miny + maxy) // 2 + 1)


alist = []
(n, m) = map(int, input().split())
for i in range(n):
	alist.append(input())
r = 0
c = 0
s = 0
for i in alist:
	for j in i:
		if j == 'B':
			r = alist.index(i)
			c += 1
			if s == 0:
				s = i.index(j)
	if c != 0:
		break
print(r + c // 2 + 1, s + c // 2 + 1)


(m, n) = list(map(int, input().split()))
fBR = -1
lBR = -1
fBC = -1
for i in range(m):
	s = input()
	j = s.find('B')
	if j != -1:
		fBC = j
		if fBR == -1:
			fBR = i
			lBR = i
		else:
			lBR = i
print((fBR + lBR) // 2 + 1, fBC + (lBR - fBR) // 2 + 1)


(n, m) = map(int, input().split())
res = 0
startX = -1
startY = -1
for i in range(n):
	st = input()
	if st.find('B') >= 0 and res <= 0:
		for j in range(m):
			if st[j] == 'B':
				res += 1
				if startX == -1:
					startX = j
					startY = i
		if res > 0:
			break
resX = startX + res // 2 + 1
resY = startY + res // 2 + 1
print(resY, resX)


(n, m) = map(int, input().split())
a = []
for i in range(n):
	b = input()
	a.append(b)
	if 'B' in b:
		l = b.find('B')
		r = b.rfind('B')
		d = (l + r) // 2
		print(1 + i + (r - l) // 2, d + 1)
		break


(n, m) = map(int, input().split())
for i in range(n):
	line = input()
	if 'B' in line:
		cnt = line.count('B')
		print(cnt // 2 + i + 1, line.find('B') + 1 + cnt // 2)
		break


(n, m) = map(int, input().split())
w = True
u = 1
jj = 1
jjj = 0
for i in range(n):
	if w:
		u += 1
	q = input()
	if 'B' in q and w:
		w = False
		j = 1
		while q[j - 1] != 'B':
			j += 1
	if w:
		jjj += 1
	if 'B' in q:
		jj += 1
print(jjj + (jj + 1) // 2, j + (jj + 1) // 2 - 1)


from math import inf

def square(n, m, lst):
	(minX, maxX, minY, maxY) = (inf, -inf, inf, -inf)
	for i in range(n):
		for j in range(m):
			if lst[i][j] == 'B':
				(minX, minY) = (min(minX, i), min(minY, j))
				(maxX, maxY) = (max(maxX, i), max(maxY, j))
	return ((minX + maxX) // 2 + 1, (minY + maxY) // 2 + 1)
(N, M) = [int(z) for z in input().split()]
a = [input() for z in range(N)]
print(*square(N, M, a))


(n, m) = map(int, input().split())
l = []
for i in range(n):
	l.append(input())
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())
found = False
for i in range(n):
	s = input()
	pos = []
	for j in range(m):
		if s[j] == 'B':
			pos.append(j)
	if not found and len(pos) > 0:
		print(i + (pos[-1] - pos[0]) // 2 + 1, (pos[0] + pos[-1]) // 2 + 1)
		found = True


nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
kv = []
for i in range(n):
	kv.append(str(input()))
t = []
r = 0
i = 0
while t == []:
	for j in range(m):
		if kv[i][j] == 'B':
			if r == 0:
				t.append(i)
				t.append(j)
			if j == m - 1 or kv[i][j + 1] == 'W':
				t.append(i)
				t.append(j)
				break
			r += 1
	i += 1
cx = t[0] + (abs(t[1] - t[3]) + 1) // 2
cy = t[1] + (abs(t[1] - t[3]) + 1) // 2
print(cx + 1, cy + 1)


(a, b) = input().split()
(a, b) = (int(a), int(b))
c = []
d = 0
for i in range(a):
	c.append(input())
	d += c[i].count('B')
n = d // 2 + 1
for i in range(a):
	for j in range(b):
		if c[i][j] == 'B':
			n -= 1
			if n == 0:
				print(i + 1, j + 1)
				break


def solve(n, m, s):
	x = None
	for i in range(n):
		k = s[i].count('B')
		if k:
			x = i
			break
	y = s[x].index('B')
	a = x + k // 2
	b = y + k // 2
	return (a + 1, b + 1)

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


(n, m) = [int(x) for x in input().split()]
s = []
for i in range(n):
	s.append(input())
xs = xe = ys = ye = -1
i = 0
while s[i].find('B') == -1:
	i += 1
ys = i + 1
while i < n and s[i].find('B') != -1:
	i += 1
ye = i
xs = s[ys - 1].find('B') + 1
xe = m - s[ys - 1][::-1].find('B')
print((ys + ye) // 2, (xs + xe) // 2)


(n, m) = [int(a) for a in input().split()]
x = []
for i in range(n):
	x.append([0 if i == 'W' else 1 for i in input()])
l = 0
for i in range(n):
	if 1 in x[i]:
		l = x[i].count(1)
		ff = i
		f = x[i].index(1)
		break
print(ff + l // 2 + 1, f + l // 2 + 1)


(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	if 'B' in s:
		a = s.find('B')
		b = s.rfind('B')
		if b - a == 0:
			print(i + 1, a + 1)
			break
		c = abs(a - b) // 2 + 1
		print(c + i, a + c)
		break


def solve():
	(n, m) = input().split()
	(n, m) = (int(n), int(m))
	arr = []
	first = (-1, -1)
	for i in range(n):
		s = ''
		col = input()
		for j in range(m):
			if col[j] == 'B':
				s += 'B'
				if first == (-1, -1):
					first = (i, j)
		if s != '':
			arr.append(s)
	if len(arr) > 0:
		print((first[0] + 1 + first[0] + len(arr)) // 2, (first[1] + 1 + first[1] + len(arr[0])) // 2)
	else:
		print(0, 0)
solve()


(n, m) = map(int, input().split())
matrix = []
find_B_start = True
B_col_start = B_row_start = B_side = 0
for i in range(n):
	row = list(str(input()))
	for j in range(m):
		if row[j] == 'B':
			if find_B_start:
				B_col_start = j + 1
				B_row_start = i + 1
				find_B_start = False
			B_side += 1
			break
middle_x = B_col_start + B_side // 2
middle_y = B_row_start + B_side // 2
print(middle_y, end=' ')
print(middle_x)


import math
(a, b) = map(int, input().split())
counter = 0
counter2 = 0
for i in range(a):
	c = str(input())
	if 'B' in c:
		print(i + 1 + c.count('B') // 2, c.index('B') + 1 + c.count('B') // 2, sep=' ')
		exit()


(n, m) = [int(x) for x in input().split()]
lst = []
nachalo = 0
konec = 0
kol = 0
for i in range(n):
	x = list(input())
	for j in range(m):
		if x[j] == 'B' and nachalo == 0:
			nachalo = [i + 1, j + 1]
			kol += 1
		elif x[j] == 'B':
			kol += 1
			konec = [i + 1, j + 1]
if konec == 0:
	print(nachalo[0], nachalo[1])
	exit()
midx = int((nachalo[0] + konec[0]) / 2)
midy = int((nachalo[1] + konec[1]) / 2)
print(midx, midy)


string = input().split(' ')
n = int(string[0])
m = int(string[1])
rowStart = -1
rowEnd = -1
colStart = -1
colEnd = -1
table = []
for i in range(n):
	string = input()
	if 'B' in string and rowStart == -1:
		colStart = string.index('B') + 1
		colEnd = string.rfind('B') + 1
	table.append(string)
colString = ''
for i in range(n):
	colString += table[i][colStart - 1]
rowStart = colString.index('B') + 1
rowEnd = colString.rfind('B') + 1
print(str((rowEnd + rowStart) // 2), str((colEnd + colStart) // 2))


(r, c) = map(int, input().split())
mat = []
for i in range(r):
	mat.append(list(input()))
x = 0
a = 0
b = 0
for i in range(r):
	for j in range(c):
		if mat[i][j] == 'B':
			x = 1
			a = i + 1
			b = j + 1
			break
	if x == 1:
		break
j = b
x = 0
while mat[a - 1][j - 1] == 'B' and j < c:
	x = x + 1
	j = j + 1
a = a + int(x // 2)
b = b + int(x // 2)
print(a, b)


(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, k) = map(int, input().split())
for i in range(1, n + 1):
	l = input()
	l = '0' + l
	indi = 0
	indj = 0
	flag = 0
	indexi = 0
	for j in range(1, k + 1):
		if l[j] == 'B':
			indi = j
			flag = 1
			break
	for j in range(indi, k + 1):
		if j == k and l[j] != 'W':
			indj = j
			break
		elif l[j] == 'W':
			indj = j - 1
			break
	indexi = i
	if flag == 1:
		break
key = indj - indi + 1
ans1 = indexi + int(key / 2)
ans2 = indi + int(key / 2)
print(ans1, ans2)


A = []
(N, M) = [int(x) for x in input().split()]
for i in range(N):
	L = input()
	A.append(L)
Len = 0
c = 0
first_occurence_row = 0
first_occurence_column = 0
for i in range(N):
	for j in range(M):
		if A[i][j] == 'B':
			first_occurence_row = i + 1
			first_occurence_column = j + 1
			Len = A[i].count('B')
			c = 1
			break
	if c == 1:
		break
new = Len // 2
print(first_occurence_row + new, first_occurence_column + new)


(n, m) = map(int, input().split())
black = []
for i in range(n):
	(s, idx) = (input(), [])
	for j in range(m):
		if s[j] == 'B':
			idx.append([i + 1, j + 1])
	if len(idx):
		black.append(idx)
print(*black[len(black) // 2][len(black[0]) // 2])


(n, m) = input().strip().split(' ')
(n, m) = [int(n), int(m)]
mat = list()
for i in range(n):
	mat.append(list(input().strip()))
resolved_mat = list()
for i in range(n):
	temp = list()
	for j in range(m):
		if mat[i][j] == 'B':
			temp.append((i, j))
	if len(temp) != 0:
		resolved_mat.append(temp)
if len(resolved_mat) == 1:
	print(resolved_mat[0][0][0] + 1, resolved_mat[0][0][1] + 1)
else:
	print((resolved_mat[0][0][0] + resolved_mat[-1][0][0]) // 2 + 1, (resolved_mat[0][0][1] + resolved_mat[0][-1][1]) // 2 + 1)


(n, m) = map(int, input().split())
s = ['W' + input() + 'W' for _ in range(n)]
s = ['W' * (m + 2)] + s + ['W' * (m + 2)]
start_m = None
end_m = None
for i in range(n + 2):
	for j in range(m + 2):
		if start_m is None and s[i][j] == 'W':
			continue
		if start_m is None and s[i][j] == 'B':
			start_m = j
			continue
		if start_m is not None and s[i][j] == 'B':
			continue
		if start_m is not None and s[i][j] == 'W':
			end_m = j - 1
			break
	if end_m is not None:
		break
start_n = None
end_n = None
for j in range(m + 2):
	for i in range(n + 2):
		if start_n is None and s[i][j] == 'B':
			start_n = i
			continue
		if start_n is not None and s[i][j] == 'B':
			continue
		if start_n is not None and s[i][j] == 'W':
			end_n = i - 1
			break
	if end_n is not None:
		break
print((start_n + end_n) // 2, (start_m + end_m) // 2)


(a, b) = map(int, input().split())
for i in range(a):
	s = input()
	z = s.count('B')
	if z > 0:
		print(i + 1 + z // 2, s.index('B') + 1 + z // 2)
		break


dic1 = []
dic2 = []
(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	for j in range(m):
		if s[j] == 'B':
			dic1.append(i + 1)
			dic2.append(j + 1)
r = dic1[len(dic1) // 2]
c = dic2[len(dic1) // 2]
print(r, c, sep=' ')


(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(range(n)):
	for j in reversed(range(m)):
		if matrix[i][j] == 'B':
			rd = (i, j)
print((lu[0] + rd[0]) // 2 + 1, (lu[1] + rd[1]) // 2 + 1)


(n, m) = map(int, input().split())
mat = []
for i in range(n):
	s = input()
	mat.append(s)
row = []
col = []
for i in range(n):
	for j in range(len(mat[0])):
		if mat[i][j] == 'B':
			row.append(i)
			col.append(j)
x = (row[0] + row[len(row) - 1]) // 2 + 1
y = (col[0] + col[len(col) - 1]) // 2 + 1
print(x, y)


(n, m) = map(int, input().split())
l = []
for i in range(n):
	s = input()
	l.append(s)
(row, col) = (0, 0)
count = 0
for r in range(n):
	for c in range(m):
		if l[r][c] == 'B':
			count += 1
			row += r + 1
			col += c + 1
print(int(row / count), int(col / count))


def main():
	(n, m) = list(map(int, input().split()))
	data = []
	for i in range(n):
		data += [input()]
	solve_data(data)

def solve_data(data):
	data2 = [s.find('B') for s in data]
	x = 0
	while data2[x] == -1:
		x += 1
	y = len(data2) - 1
	while data2[y] == -1:
		y -= 1
	mid1 = (y + x) // 2
	data3 = data[mid1]
	x = 0
	while data3[x] == 'W':
		x += 1
	y = len(data3) - 1
	while data3[y] == 'W':
		y -= 1
	mid2 = (y + x) // 2
	print(mid1 + 1, mid2 + 1)
main()


(n, m) = map(int, input().split())
listi = []
for i in range(0, n):
	string = input()
	listi.append(string)
rownum = 0
flag = False
for row in listi:
	for letter in row:
		if 'B' in row:
			p = row.index('B')
			s = row[::-1]
			q = abs(m - s.index('B') - 1)
			if p == q:
				print(rownum + 1, row.index(row[p]) + 1)
				flag = True
				break
			mr = (q + p) / 2
			length = abs(q - p + 1)
			rn = rownum + length // 2
			print(rn + 1, int(mr + 1))
			flag = True
			break
	if flag == True:
		break
	rownum += 1


k = list(map(int, input().split(' ')))
n = k[0]
m = k[1]
f = []
for i in range(n):
	l = input()
	f.append(l)
for t in range(n):
	for y in range(m):
		if f[t][y] == 'B':
			break
	if f[t][y] == 'B':
		break
r = 0
for i in range(m):
	if f[t][i] == 'B':
		r = i
j = r - y + 1
if j == 1:
	print(t + 1, y + 1)
else:
	print(t + 1 + j // 2, y + 1 + j // 2)


(n, m) = map(int, input().split())
(xmin, ymin, xmax, ymax) = (n, m, 0, 0)
for i in range(n):
	for (j, e) in enumerate(input()):
		if e == 'B':
			(xmin, ymin, xmax, ymax) = (min(xmin, i), min(ymin, j), max(xmax, i), max(ymax, j))
print((xmin + xmax) // 2 + 1, (ymin + ymax) // 2 + 1)


[n, m] = input().split()
n = int(n)
m = int(m)
arr = [None for _ in range(n)]
for i in range(n):
	arr[i] = input()
flag = None
flag1 = None
for i in range(n):
	for j in range(m):
		if flag == None and arr[i][j] == 'B':
			flag = [i + 1, j + 1]
		if flag != None and arr[i][j] == 'B':
			flag1 = [i + 1, j + 1]
print((flag[0] + flag1[0]) // 2, (flag[1] + flag1[1]) // 2)


(n, m) = map(int, input().split())
lock = 0
for i in range(n):
	s = str(input())
	if 'B' in s and lock == 0:
		Rstart = s.index('B')
		cnt = s.count('B')
		Rcen = Rstart + cnt // 2
		Cstart = i
		Ccen = Cstart + cnt // 2
		lock = 1
print(Ccen + 1, Rcen + 1)


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
r = 0
while a[r].find('B') < 0:
	r += 1
d = 0
while r + d < n and a[r + d].find('B') >= 0:
	d += 1
print(*(r + d // 2 + 1, a[r].find('B') + a[r].count('B') // 2 + 1))


n = list(map(int, input().split()))
l = []
s = [0] * 116
w = [0] * 116
f = 0
t = 0
p = -1
q = -1
for i in range(n[0]):
	o = list(input())
	l += [o]
for i in range(n[0]):
	for j in range(n[1]):
		if l[i][j] == 'B':
			p = i
			q = j
			break
	if (p or q) != -1:
		break
for i in range(n[0]):
	if 'B' in l[i]:
		t += 1
p = p + t // 2 + 1
q = q + t // 2 + 1
print(p, q)


a = input()
b = a.split()
no_of_lines = b[0]
lines = ''
for i in range(int(b[0])):
	lines += input() + '\n'
L1 = []
L2 = []
L3 = []
for elem in lines:
	L1 = L1 + [elem]
for elem in lines:
	if elem == '\n':
		L1.remove(elem)
for i in range(1, int(b[0]) * int(b[1]) + 1):
	L2 = L2 + [i]
for i in range(0, int(b[0]) * int(b[1])):
	if L1[i] == 'B':
		L3 = L3 + [L2[i]]
x = int(L3[int((len(L3) - 1) / 2)])
if x % int(b[1]) != 0:
	print(int(x / int(b[1]) + 1), int(x % int(b[1])))
elif x % int(b[1]) == 0:
	print(int(x / int(b[1])), int(b[1]))


H = input().split()
n = int(H[0])
m = int(H[1])
A = []
for i in range(n):
	A.append(list(input()))
for i in range(n):
	if 'B' in A[i]:
		z = i
		for j in range(n - 1, -1, -1):
			if 'B' in A[j]:
				print((i + j) // 2 + 1)
				break
		break
for q in range(m):
	if A[z][q] == 'B':
		for r in range(m - 1, -1, -1):
			if A[z][r] == 'B':
				print((q + r) // 2 + 1)
				break
		break


(n, m) = list(map(int, input().split()))
for i in range(n):
	s = input()
	if 'B' in s:
		(row, col) = (i, s.find('B'))
		d = s.rfind('B') - col + 1
		break
print(row + d // 2 + 1, col + d // 2 + 1)


(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	if s.count('B') > 0:
		index = s.find('B')
		counter = s.count('B')
		row = i + counter // 2 + 1
		column = index + counter // 2 + 1
		print(row, column)
		break


(n, m) = map(int, input().split())
k = 0
f1 = 1
f2 = 1
r = 0
c = 0
for i in range(1, n + 1):
	a = input()
	if k == 0:
		for j in range(1, m + 1):
			if a[j - 1] == 'B':
				k += 1
				if f1:
					c = j
					f1 = 0
	if 'B' in a and f2:
		r = i
		f2 = 0
k //= 2
print(r + k, c + k)


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


(n, m) = list(map(int, input().split()))
temp = 0
a = [list(input()) for i in range(n)]
for i in range(n):
	ok = False
	for j in range(m):
		if a[i][j] == 'B':
			pos1 = i
			pos2 = j
			temp += 1
			temp2 = j
			if j != m - 1:
				ok = True
				while True:
					ok2 = False
					if temp2 == m - 1:
						ok2 = True
						break
					if a[i][temp2 + 1] != 'B':
						ok2 = True
						break
					temp += 1
					temp2 += 1
			elif j == m - 1:
				temp = 1
				ok = True
				break
			if ok2:
				break
	if ok:
		break
print(temp // 2 + pos1 + 1, temp // 2 + pos2 + 1)


(n, m) = map(int, input().split())
i = 0
s = input()
while s.find('B') == -1:
	s = input()
	i += 1
l = i + 1
fst = s.find('B') + 1
sec = s.rfind('B') + 1
a = sec - fst
print(l + a // 2, fst + a // 2)


(n, m) = map(int, input().split())
for row in range(n):
	line = input()
	start = float('inf')
	end = float('-inf')
	for col in range(m):
		if line[col] == 'B':
			start = min(start, col)
			end = max(end, col)
	if start != float('inf'):
		size = end - start + 1
		half_size = size // 2
		start_row = row + 1
		start_col = start + 1
		print(start_row + half_size, start_col + half_size)
		break


(n, m) = map(int, input().split())
a = ''
for i in range(n):
	s = input()
	a += s
y1 = a.find('B') % m + 1
x1 = a.find('B') // m + 1
y2 = a.rfind('B') % m + 1
x2 = a.rfind('B') // m + 1
print(int((x1 + x2) / 2), int((y1 + y2) / 2))


(n, m) = map(int, input().split())
t = []
nb = 0
for i in range(n):
	t.append(input())
	nb = max(nb, t[i].count('B'))
test = False
for i in range(n):
	for j in range(m):
		if t[i][j] == 'B':
			c = (i, j)
			test = True
			break
	if test:
		break
print(c[0] + nb // 2 + 1, c[1] + nb // 2 + 1)


import math
s = input().split(' ')
n_line = int(s[0])
para = []
while n_line > 0:
	line = input()
	para.append(line)
	n_line = n_line - 1
(b, f_line, f_col) = (0, 0, 0)
for (i, j) in enumerate(para):
	for (m, n) in enumerate(j):
		if n == 'B':
			f_line = i
			f_col = m
			b = b + 1
fix = int((math.sqrt(b) - 1) / 2)
print(f_line + 1 - fix, f_col + 1 - fix)


def avg(collection):
	collection = list(collection)
	return sum(collection) // len(collection)
(n, m) = map(int, input().split())
A = [input() for i in range(n)]
rows_with_black = filter(lambda i: 'B' in A[i], range(n))
cols_with_black = filter(lambda j: 'B' in (A[i][j] for i in range(n)), range(m))
print(avg(rows_with_black) + 1, avg(cols_with_black) + 1)


(n, m) = list(map(int, input().split()))
i = 1
rows_black = 0
colum_black = 0
b = []
ans = 1
while i <= n:
	a = input()
	if a.count('B') >= 1:
		colum_black += 1
	for x in a:
		if x == 'B':
			if ans == 1:
				b.append(i)
				b.append(a.index(x) + 1)
				ans = 0
			rows_black += 1
	i += 1
for x in b:
	print(x + colum_black // 2, end=' ')


a = input().split()
y = int(a[0])
x = int(a[1])
a = []
for i in range(y):
	a += [input()]
s = 0
i = 0
v = 0
true = True
while true:
	for j in range(x):
		if a[v][j] == 'B':
			if true:
				i = j
				true = False
			s += 1
	v += 1
print(v + s // 2, i + s // 2 + 1)


(n, m) = map(int, input().split())
(l, k) = (0, 0)
b = []
for i in range(n):
	a = list(input())
	if 'B' in a:
		b.append(i)
		for j in range(m):
			if a[j] == 'B':
				l = j
				break
		for j in range(m - 1, -1, -1):
			if a[j] == 'B':
				k = j
				break
y = l + (k - l) // 2 + 1
x = b[0] + (b[-1] - b[0]) // 2 + 1
print(x, y)


(n, m) = map(int, input().split())
(s, d) = ([], [])
for i in range(n):
	s.append(input())
for i in range(n):
	if s[i].count('B') > 0:
		d.append(s[i].count('B'))
		d.append(i + 1)
		q = s.pop(i)
		break
for j in range(m):
	if q[j] == 'B':
		d.append(j + 1)
		break
a = d[0] // 2 + d[1]
b = d[0] // 2 + d[2]
print(a, b)


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
flag = 0
c = []
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B':
			c.append(j)
			flag = 1
	if flag == 1:
		if len(c) > 0:
			k = len(c) // 2
			t = c[k] + 1
		if len(c) == 0:
			t = 1
		break
c = 0
b = []
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B':
			b.append(i)
			break
if len(b) > 0:
	m = len(b) // 2
	r = b[m] + 1
if len(b) == 0:
	r = 1
print(r, t)


(m, n) = [int(x) for x in input().split()]
graph = [input() for x in range(m)]
start_row = -1
ans_col = 0
for i in range(m):
	if start_row < 0 and 'B' in graph[i]:
		start_row = i
		ans_col = (graph[i].rindex('B') + graph[i].index('B')) / 2 + 1
	if start_row >= 0 and 'B' not in graph[i]:
		print(int((i + start_row) / 2 + 1), int(ans_col))
		exit()
print(int((start_row + 1 + m) / 2), int(ans_col))


import sys
line = []
[n, m] = map(int, input().split())
for i in range(n):
	line.append(input())

def check_square(x, y):
	sqlen = 1
	for i in range(x + 1, n):
		if line[i][y] == 'B':
			sqlen = sqlen + 1
	return sqlen
for i in range(n):
	for j in range(m):
		if line[i][j] == 'B':
			sqlen = check_square(i, j)
			print('%d  %d' % (1 + i + sqlen / 2, 1 + j + sqlen / 2))
			sys.exit(0)


(n, k) = list(map(int, input().split()))
f = []
resultX = 0
resultY = 0
for i in range(n):
	line = [ch for ch in input()]
	f.append(line)
	lc = line.count('B')
	if lc != 0:
		resultY = line.index('B') + lc // 2
		resultX = i + lc // 2
		print(resultX + 1, resultY + 1)
		break


import math
(r, c) = map(int, input('').split(' '))
tableau = []
for i in range(r):
	tableau.append(str(input('')))
ligne = 0
while not 'B' in tableau[ligne]:
	ligne += 1
taille = tableau[ligne].count('B')
place = tableau[ligne].index('B')
centrecol = math.ceil(taille / 2) + place
centrelig = math.ceil(taille / 2) + ligne
print(centrelig, centrecol)


(n, m) = map(int, input().split())
a = []
for _ in range(n):
	a += [list(input())]
co = 0
x = None
for i in range(n):
	for j in range(m):
		if a[i][j] == 'B':
			co += 1
			if x is None:
				x = j
	if co:
		y = i
		break
d = co // 2 + 1
c = x + d
r = y + d
print(r, c)


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


(n, m) = [int(v) for v in input().split()]
left = m - 1
right = 0
top = n - 1
bottom = 0
for i in range(n):
	for (j, ch) in enumerate(input().strip()):
		if ch == 'B':
			left = min(left, j)
			right = max(right, j)
			top = min(top, i)
			bottom = max(bottom, i)
r = top + (bottom - top) // 2
c = left + (right - left) // 2
print(r + 1, c + 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) = map(int, input().split())
s = []
for i in range(n):
	s.append(list(input()))
l = 0
r = 0
for i in range(n):
	for j in range(m):
		if s[i][j] == 'B':
			l = i
			r = j
			break
	else:
		continue
	break
leng = 0
while r < m and s[l][r] == 'B':
	leng += 1
	r += 1
print(l + 1 + leng // 2, r - leng // 2)


from pprint import pprint
import sys
input = sys.stdin.readline
(h, w) = map(int, input().split())
dat = []
for _ in range(h):
	l = input()
	dat.append(l)
(sx, sy) = (-1, -1)
(rw, rh) = (0, 0)
for hh in range(h):
	rw = max(dat[hh].count('B'), rw)
	if sx == -1 and dat[hh].find('B') != -1:
		sx = dat[hh].find('B')
		sy = hh
print(sy + (rw + 1) // 2, sx + (rw + 1) // 2)


def main():
	(n, m) = [int(v) for v in input().split()]
	min_x = m
	max_x = 0
	min_y = n
	max_y = 0
	for i in range(n):
		d = input()
		for (j, c) in enumerate(d):
			if c == 'B':
				min_x = min(j + 1, min_x)
				min_y = min(i + 1, min_y)
				max_x = max(j + 1, max_x)
				max_y = max(i + 1, max_y)
	print(min_y + (max_y - min_y) // 2, min_x + (max_x - min_x) // 2)
main()


(n, m) = map(int, input().split())
s = []
for i in range(0, n):
	s.append(input())
for (row, lst) in enumerate(s):
	if 'B' in lst:
		col = lst.index('B')
		count = lst.count('B')
		break
row = row + int(count / 2) + 1
col = col + int(count / 2) + 1
print(row, col)


(n, m) = list(map(int, input().split(' ')))
c = 0
l = []
l1 = []
for i in range(1, n + 1):
	s = list(input())
	if 'B' in s:
		l.append(i)
		if c == 0:
			for i in range(m):
				if s[i] == 'B':
					l1.append(i + 1)
			c = c + 1
k = (l[0] + l[len(l) - 1]) // 2
print(k, end=' ')
k = (l1[0] + l1[len(l1) - 1]) // 2
print(k, end=' ')


(n, m) = map(int, input().split())
(fr, lr) = (float('inf'), 0)
c = -1
for i in range(n):
	s = input()
	(b, e) = (s.find('B'), s.rfind('B'))
	if b != -1:
		fr = min(fr, i)
		lr = max(lr, i)
		c = b + (e - b) // 2 + 1
print(1 + fr + (lr - fr) // 2, c)


from collections import Counter

def solve(lines):
	(min_j, min_i) = next(((j, i) for (i, line) in enumerate(lines) for (j, c) in enumerate(line) if c == 'B'))
	max_j = max((j for (j, c) in enumerate(lines[min_i]) if c == 'B'))
	max_i = max((i for (i, line) in enumerate(lines) if 'B' in line))
	return ((min_i + max_i) // 2, (min_j + max_j) // 2)
(m, n) = map(int, input().split())
lines = [input().strip() for _ in range(m)]
(i, j) = solve(lines)
print(i + 1, j + 1)


input()
(y, x) = (-1, -1)
while x < 0:
	a = input()
	x = a.find('B')
	y += 1
b = a.count('B') // 2 + 1
print(y + b, x + b)


(n, m) = [int(x) for x in input().split()]
di = {'W': 0, 'B': 1}
l = [[di[x] for x in input()] for i in range(n)]

def fu_b(x, y):
	global l, m, n
	i = y
	while i < m and l[x][i] != 0:
		i += 1
	a = i - y
	return [x + a // 2, y + a // 2]
(x, y) = [0] * 2
d = False
for i in range(n):
	for j in range(m):
		if l[i][j]:
			(x, y) = fu_b(i, j)
			d = True
			break
	if d:
		break
print(x + 1, y + 1)


def solve():
	(n, m) = input().split()
	res = {}
	for i in range(int(n)):
		a = input()
		res[i + 1] = []
		for l in range(int(m)):
			if a[l] == 'B':
				res[i + 1].append(l + 1)
	return res
x = solve()
index = 0
count = 0
final = 0
final_b = 0
for i in x.values():
	index += 1
	if len(i) == 1:
		final = index
		final_b = i[0]
	elif len(i) > 1:
		final += index
		count += 1
		final_b = i[int(len(i) / 2)]
final_a = int(final / count) if count != 0 else final
print(final_a, final_b)


(n, m) = map(int, input().split())
ans = 0
arr = []
for i in range(n):
	s = str(input())
	arr.append(s)
arr1 = []
for i in range(n):
	if 'B' in arr[i]:
		arr1.append(i)
arrx = []
for i in range(m):
	s1 = ''
	for j in range(n):
		s1 += arr[j][i]
	arrx.append(s1)
arr2 = []
for i in range(m):
	if 'B' in arrx[i]:
		arr2.append(i)
print((arr1[-1] + arr1[0] + 2) // 2, (arr2[-1] + arr2[0] + 2) // 2)


(a, b) = list(map(int, input().split()))
startx = 0
lent = 0
starty = 0
for j in range(a):
	t = input()
	if 'B' in t:
		starty = t.index('B') + 1
		startx = j + 1
		lent = t.count('B')
		break
print(startx + lent // 2, starty + lent // 2)


(n, m) = map(int, input().split())
(b, c) = ([], [])
for i in range(n):
	a = input()
	if 'B' in a:
		b.append(i + 1)
	for j in range(m):
		if a[j] == 'B':
			c.append(j + 1)
print(sum(b) // len(b), sum(c) // len(c))


(n, m) = list(map(int, input().split()))
k = [['W'] * m] * n
b = 0
rj = 0
ri = 0
check = True
for i in range(n):
	k[i] = list(str(input()))
	if check:
		if 'B' in k[i]:
			rj = k[i].index('B')
			ri = i
			for j in range(m):
				if k[i][j] == 'B':
					b += 1
			check = False
print(ri + b // 2 + 1, rj + b // 2 + 1)


import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
from collections import defaultdict
from math import sqrt
INF = pow(2, 63)

def isPrime(number):
	assert isinstance(number, int) and number >= 0, "'number' must been an int and positive"
	status = True
	if number <= 1:
		status = False
	for divisor in range(2, int(round(sqrt(number))) + 1):
		if number % divisor == 0:
			status = False
			break
	assert isinstance(status, bool), "'status' must been from type bool"
	return status

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

def greatest_common_divisor(a: int, b: int) -> int:
	return abs(b) if a == 0 else greatest_common_divisor(b % a, a)

def solveb(n, tuparr):
	return -1
import math

def solve(n, m, sarr):
	for (r, s) in enumerate(sarr):
		s = str(s)
		(i, j) = (s.find('B'), s.rfind('B'))
		if not i >= 0:
			continue
		return (r + (j - i) // 2 + 1, (j + i) // 2 + 1)

def main():
	[n, m] = list(map(int, input().strip().split()))
	sarr = []
	for _ in range(n):
		sarr.append(input().strip())
	(a, b) = solve(n, m, sarr)
	print(a, b)

def mainb():
	pass
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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()
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


l = []
(c, r) = ([], [])
f = 1
(n, m) = map(int, input().split())
for i in range(1, n + 1):
	s = input()
	x = s.find('B')
	if x != -1:
		c.append((i, x + 1))
le = len(c)
print((2 * c[0][0] + le - 1) // 2, (2 * c[0][1] + le - 1) // 2)


(n, m) = input().split()
n = int(n)
m = int(m)
arr = [[0 for j in range(m)] for i in range(n)]
for i in range(n):
	arr[i] = input()
found = 0
for i in range(n):
	for j in range(m):
		if arr[i][j] == 'B':
			a = i
			b = j
			found = 1
			break
	if found == 1:
		break
nor = 0
for i in range(a, n - 1):
	if arr[i + 1][b] == 'B':
		nor += 1
	else:
		break
len = nor // 2
a = a + len + 1
b = b + len + 1
print('{} {}'.format(a, b))


(n, m) = map(int, input().split())
l1 = []
for i in range(n):
	l = list(input())
	l1.append(l)
(l2, l3) = ([], [])
for i in range(n):
	for j in range(m):
		if l1[i][j] == 'B':
			l2.append(i + 1)
			l3.append(j + 1)
x = len(l2) // 2
y = len(l3) // 2
print(l2[x], l3[y])


(n, m) = map(int, input().split())
for i in range(n):
	s = input()
	if s.count('B') != 0:
		(x0, y0) = (s.find('B') + 1, i + 1)
		N = s.count('B')
		break
print(y0 + N // 2, x0 + N // 2)


import statistics
(H, W) = map(int, input().split())
ws = set()
hs = set()
for h in range(H):
	raw = input()
	lw = [index for (index, w) in enumerate(raw) if w == 'B']
	lh = [h for (index, w) in enumerate(raw) if w == 'B']
	ws |= set(lw)
	hs |= set(lh)
left = statistics.mean(ws) + 1
right = statistics.mean(hs) + 1
print(right, left)


(n, m) = [int(i) for i in input().split(' ')]
li = []
for i in range(n):
	s = input()
	li.append(s)
arr = []
for i in range(n):
	for j in range(m):
		if li[i][j] == 'B':
			(x, y) = (i + 1, j + 1)
			arr.append(x)
			arr.append(y)
if len(arr) == 2:
	print(arr[0], arr[1])
else:
	a = len(arr) // 2 - 1
	b = len(arr) // 2
	print(arr[a], arr[b])


(n, m) = map(int, input().split())
a = []
ind = 0
row = 0
col = 0
for i in range(n):
	cc = 0
	b = input()
	for j in range(len(b)):
		if b[j] == 'B':
			cc += 1
			ind = j
			row = i
	if cc > 0:
		col = cc
print(row + 1 - col // 2, ind + 1 - col // 2)


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n, m) = I()
s = ''
i = 0
while i < n:
	s = input()
	if 'B' in s:
		c = s.count('B')
		break
	i += 1
k = s.index('B')
print(i + 1 + c // 2, k + 1 + c // 2)


(n, m) = map(int, input().split())
grass = []
sq = []
for _ in range(0, n):
	mm = [i for i in input()]
	grass.append(mm)
for i in range(0, n):
	for j in range(0, m):
		if grass[i][j] == 'B':
			sq.append((i + 1, j + 1))
print(sq[len(sq) // 2][0], sq[len(sq) // 2][1])


(n, m) = map(int, input().split())
l = []
d = []
for i in range(n):
	l.append(input())
for i in range(n):
	for j in range(m):
		if l[i][j] == 'B':
			d.append([i + 1, j + 1])
print(*d[len(d) // 2])


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(1000000000.0)
	(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):
	l1 = list(input())
	l.append(l1)
final_list = []
for i in l:
	lp = []
	for j in range(m):
		if i[j] == 'B':
			lp.append(j)
	if len(lp) != 0:
		x = l.index(i) + len(lp) // 2
		y = i.index('B') + len(lp) // 2
		print(x + 1, y + 1)
		exit()


ar = [int(i) for i in input().split()]
n = ar[0]
m = ar[1]
ar = []
for i in range(n):
	s = list(input())
	ar.append(s)
	s = []
c = 1
ar2 = []
ar3 = []
for i in range(0, n):
	if c == 0:
		break
	for j in range(0, m):
		if ar[i][j] == 'B':
			ar2 = [i, j]
			c = 0
			break
for i in range(n):
	for j in range(m):
		if ar[i][j] == 'B':
			ar3 = [i, j]
center = [(ar2[0] + ar3[0]) / 2, (ar2[1] + ar3[1]) / 2]
for i in center:
	print(int(i) + 1, end=' ')


(n, m) = map(int, input().split())
(row, col) = (0, 0)
for i in range(n):
	S = list(input())
	if 'B' in S:
		print(i + 1 + int(S.count('B') / 2), S.index('B') + 1 + int(S.count('B') / 2), sep=' ')
		exit()


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	arr.append(input())
count = 0
start = False
k = 0
r_index = 0
c_index = 0
for i in arr:
	s_index = i.find('B')
	f_index = i.rfind('B')
	k += 1
	if s_index == -1:
		continue
	else:
		r_index = (s_index + f_index) // 2 + 1
		c_index = k - count // 2
		count += 1
print(c_index, r_index)


def main():
	(n, m) = map(int, input().split())
	(l, r, t, b) = (m + 1, -1, n + 1, -1)
	grid = [input() for _ in range(n)]
	for i in range(n):
		for j in range(m):
			if grid[i][j] == 'B':
				l = min(l, j)
				r = max(r, j)
				t = min(t, i)
				b = max(b, i)
	x = (l + r) // 2
	y = (t + b) // 2
	print(y + 1, x + 1)
main()