
A square board of size n \times n is given. It is known that the board has been used for an intellectual game, as a result of which its cells are colored white, black, or green. The coloring may be arbitrary (as this is an intellectual game!), but all cells of the topmost row are white, and all cells of the bottommost row are black. To determine the winner, you need to count the number of cells in the white and black areas.
The white area is defined as the largest possible (in terms of the number of cells) contiguous part of the board, bounded above by the top edge of the board, and on the remaining sides by a continuous boundary passing only through white cells. No cell of this boundary may occur more than once. The boundary is a sequence of adjacent white cells (where adjacency means sharing a common side). The boundary must start at the upper left cell and end at the upper right cell of the board.
The definition of the black area is analogous: it is bounded below by the bottom edge of the board, and on the remaining sides by a continuous black boundary passing only through black cells, starting at the lower left and ending at the lower right cell of the board.
Write a program that, given the coloring of the board, finds the number of cells in the white and black areas.
The first line contains the size of the board (5 \leq n \leq 250). Each of the next lines contains characters: "G", "W", or "B" (without spaces), representing the colors green, white, and black, respectively.
The first line should contain the number of cells in the white area, and the second line should contain the number of cells in the black area.
Example 1