use std::collections::VecDeque; const DX: [isize; 4] = [-1, 1, 0, 0]; const DY: [isize; 4] = [0, 0, -1, 1]; const INF: usize = 1usize << 60; fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let m = nm[1]; let mut mapping = vec![vec![INF; n]; n]; let mut deque = VecDeque::new(); deque.push_back((0, 0)); while let Some((x, y)) = deque.pop_front() { if mapping[x][y] < INF { continue; } println!("{} {}", x+1, y+1); let mut temp = String::new(); std::io::stdin().read_line(&mut temp).ok(); let temp = temp.trim(); if temp == "Black" { mapping[x][y] = 1; } else { mapping[x][y] = 0; continue; } for dir in 0..4 { let nx = x as isize + DX[dir]; let ny = y as isize + DY[dir]; if nx >= 0 && ny >= 0 && nx < n as isize && ny < n as isize { let nx = nx as usize; let ny = ny as usize; if mapping[nx][ny] == INF { deque.push_back((nx, ny)); } } } if mapping[n-1][n-1] < INF { break; } } if mapping[n-1][n-1] == INF { println!("No"); } else { println!("Yes"); } }