H. Go Iguanas!
time limit per test
5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Many people are not aware of the fact that iguanas love to play the classic board game of Go. The game is played on an $$$N \times M$$$ board where each square is initially empty. Two players take turns placing either black or white tiles on empty squares. Tiles are considered adjacent if they share a side. If a group of adjacent tiles of the same color are "surrounded" by tiles of the opposite color, they will be removed from the board and play proceeds.

Surrounded can be defined in terms of "liberties". A group of tiles of one color has a number of liberties equal to the number of empty tiles adjacent to the group. A single tile can have up to four liberties. A group of tiles is surrounded if it has exactly zero liberties.

A pair of particularly clever iguanas have been playing a long game of Go, and at some point they have become quite tired. Both sides would like to consider various candidate moves, but they would not like their own tiles to become surrounded. They each give you various positions on the board where they could make a move, and it is your job to tell them if that move will result in a group of their tiles becoming surrounded.

Input

The input will begin with a line containing exactly three integers, $$$N\ (1 \leq N \leq 1,000)$$$, $$$M\ (1 \leq M \leq 1,000)$$$, and $$$Q\ (1 \leq Q \leq 10,000)$$$.

The next $$$N$$$ lines will each consist of $$$M$$$ characters, describing the current state of the Go board. Each of the $$$N \times M$$$ characters will be either "B", indicating a black tile, "W", indicating a white tile, or ".", indicating an empty space.

The final $$$Q$$$ lines of input will each consist of a character $$$T$$$, either "B" or "W", followed by exactly two integers, $$$X\ (1 \leq X \leq N)$$$, and $$$Y\ (1 \leq Y \leq M)$$$. Each of these $$$Q$$$ lines describes a candidate move that either the iguana playing the black tiles or white tiles would like you to consider. It is guaranteed that the square specified by the given coordinates is an empty square.

Output

For each of the $$$Q$$$ candidate moves, output a single line. If placing a tile of color $$$T$$$ at position $$$X$$$, $$$Y$$$ (in row-major order) on the board would lead to a group of tiles of the same color as $$$T$$$ becoming surrounded, output "No go!" (without quotes). Otherwise, output "Go!" (no quotes).

The output for the queries should be in the same order as the queries themselves, though the moves are not persistent; each queried move does not persist for the duration of the test case and is instead simply a candidate move.

Example
Input
3 3 4
.BW
B.W
WWW
B 1 1
B 2 2
W 1 1
W 2 2
Output
Go!
Go!
No go!
No go!