Description
The latest Martian probe is trapped in a two-dimensional maze made up of squares.
There are four types of squares:
'.' On behalf of the open space, Curiity can pass through it
'#'Represents an obstacle that can not be crossed, can not stay
'S' Represents the starting position of curliity
'T' Represents the destination for curiity.
Input
The first line is an integer T, which means that there are several test samples
The first line of each test sample is an integer N(1<=N<=50))Represents the size of the maze(N * N). The subsequent N-row consists of N strings each, representing the maze. The next line is an integer Q, which represents how many queries there are. The next row of Q is a string consisting of only four letters of "LRUD". The length of the character is less than 1000.
Output
Output a separate line for each query:
"I get there! ": After executing the given command, Curiity finally reached the end.
"I have no idea! ": After executing the given command, curiity failed to reach the finish line.
"I am dizzy! ": Curiity hit an obstacle during the execution of the order.
"I am out! ": On behalf of Curiity, the boundary of the maze was stepped out in the process of executing the command.
2
2
S.
#T
2
RD
DR
3
S.#
.#.
.T#
3
RL
DDD
DDRR
I get there!
I am dizzy!
I have no idea!
I am out!
I get there!