use std::collections::VecDeque; 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]; if 2*n-1 > m { println!("No"); return; } let mut grid = vec![vec![2usize; n]; n]; grid[0][0] = 1; let mut cnt = 0usize; let mut deque = VecDeque::new(); deque.push_back((0, 1)); deque.push_back((1, 0)); while let Some((x, y)) = deque.pop_front() { if grid[x][y] < 2 { 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 == "White" { grid[x][y] = 0; } else { grid[x][y] = 1; if x+1 < n && grid[x+1][y] == 2 { deque.push_front((x+1, y)); } if y+1 < n && grid[x][y+1] == 2 { deque.push_front((x, y+1)); } } cnt += 1; if cnt == 3000 { break; } } println!("{}", if grid[n-1][n-1] == 1 { "Yes" } else { "No" }); }