CF1028A.Find Square

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Find Square

Consider a table of size n×mn \times m, initially fully white. Rows are numbered 11 through nn from top to bottom, columns 11 through mm 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 nn and mm (1n,m1151 \le n, m \le 115) — the number of rows and the number of columns in the table.

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

Output

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

Samples

5 6
WWBBBW
WWBBBW
WWBBBW
WWWWWW
WWWWWW
2 4
3 3
WWW
BWW
WWW
2 1

在线编程 IDE

建议全屏模式获得最佳体验