using System.Collections.Generic;
static void nextMove(int n,int r, int c, String [] grid){
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(grid[i][j].CompareTo('p') == 0){
distanceX = botX - ladyX;
distanceY = botY - ladyY;
Console.WriteLine("bot: " + botX + ", " + botY);
Console.WriteLine("princess: " + ladyX + ", " + ladyY);
Console.WriteLine("distance: " + distanceX + ", " + distanceY);
while(botX != ladyX || botY != ladyY){
if(Math.Abs(distanceX) > Math.Abs(distanceY)){
Console.Write("RIGHT\n");
distanceX = botX - ladyX;
distanceY = botY - ladyY;
Console.WriteLine("distance: " + distanceX + ", " + distanceY);
public static void Main() {
n = int.Parse(Console.ReadLine());
pos = Console.ReadLine();
String[] position = pos.Split(' ');
int [] int_pos = new int[2];
int_pos[0] = Convert.ToInt32(position[0]);
int_pos[1] = Convert.ToInt32(position[1]);
String[] grid = new String[n];
for(int i=0; i < n; i++) {
grid[i] = Console.ReadLine();
nextMove(n, int_pos[0], int_pos[1], grid);