Carl and Nathan find chess far too easy, so they invented a game of their own.
The game is played on a board with n rows and m columns. At the start each column holds one white pawn and one black pawn, and in every column the white pawn is on a lower square than the black pawn. White moves the white pawns and Black moves the black pawns. White goes first, and the players then take turns.
A move takes one of your own pawns one square forward, and that square must be empty. Forward means toward the opponent, so white pawns move up and black pawns move down. A pawn on its own first rank, meaning a white pawn on the bottom row or a black pawn on the top row, may move two squares forward instead. In that case the square it passes over and the square it lands on must both be empty. Unlike ordinary chess, pawns are never captured and never change column.
So a white pawn on the bottom row with two empty squares above it has two moves, one square up and two squares up. A pawn with an occupied square directly in front of it has no move at all.
Play continues until the two pawns of every column stand next to each other and neither player can move. The game ends there, and the player who made the last move wins.
Both players play optimally. Determine who wins.
The first line has the number of test cases, a positive integer at most 100. Each test case is given as follows.
W is a white pawn, B is a black pawn, . is an empty square. Each column holds exactly one W and exactly one B, and the W is below the B.White has at least one move in every test case.
Print one line per test case: White wins if White wins with optimal play, or Black wins if Black has a winning strategy.