This is an interactive problem.
Cindy is playing a so-called "Kaizo" ROMHack of Pokémon Crystal, meaning that fans had modified the game to massively increase the difficulty to infuriating (unfair?) levels. For some modders, this can include not just the Pokémon battles, but also the overworld puzzles.
The Ghost Gym in Ecruteak city has a puzzle which goes as follows (slightly modified for simplicity).
Of course, the "maze" in the base game is very simple, but the Kaizo modders have gone out of their way to make their maze as painful as possible. Cindy has been attempting this for hours and is starting to get tilted. She asks you if it's possible to develop a program that can solve this problem for her.
The judge first outputs two space-separated integers $$$r$$$ and $$$c$$$, the dimensions of the grid.
Then, you can now move around the grid. You can make statements to the judge:
$$$$$$\begin{align*}
&\begin{array}{|l|} \hline \text{Constraints For All Subtasks} \\ \hline 2 \leq r, c \leq 20 \\ \hline \end{array}\\
&\begin{array}{|c|c|l|} \hline \text{Subtask} & \text{Points} & \text{Constraints} \\ \hline 1 & \mathbf{35} & r = c = 2 \\ \hline 2 & \mathbf{20} & r, c \leq 5 \\ \hline 3 & \mathbf{20} & \text{It is possible, and all }\mathtt{OKAY}\text{ squares lie on \\ the unique shortest path from start to finish.} \\ \hline 2 & \mathbf{25} & \text{No further constraints.} \\ \hline \end{array}\\
\end{align*}$$$$$$
Here is a sample interaction. We also provide the map, with safe squares colored lilac, and traps colored a deep indigo. The interaction corresponds to the following steps on the map—stepping on a trap (and being sent back to the start) is represented by the red exclamation point. We remind you that the contestant does not have access to this map—it's only provided to you here to help understand the sample.
Here is another sample interaction. Here, the map is not solvable, so the contestant is correct for saying the game is RIGGED
Judge Contestant
4 6
S
SAFE
S
TRAP
S
SAFE
E
SAFE
E
SAFE
E
TRAP
S
SAFE
E
SAFE
E
SAFE
N
SAFE
E
SAFE
E
SAFE
E
SAFE
S
SAFE
S
SAFE
S
YAY
Judge Contestant
3 3
S
TRAP
E
TRAP
RIGGED