use std::io; use std::str::FromStr; use std::cmp::{ min, max }; use std::collections::{ BinaryHeap, VecDeque }; fn main() { let mut sc = Scanner::new(); let h = sc.cin(); let w = sc.cin(); let n = sc.cin(); let mut f: Vec> = vec![vec![0;w]; h]; for i in 0..h { for j in 0..w { f[i][j] = (i+j) % 2; } } for i in 0..n { let s: char = sc.get_char(); let k: usize = sc.cin(); if s == 'R' { let tmp = f[k][w-1]; for j in (1..w).rev() { f[k][j] = f[k][j-1]; } f[k][0] = tmp; } else { let tmp = f[h-1][k]; for j in (1..h).rev() { f[j][k] = f[j-1][k]; } f[0][k] = tmp; } } println!("{}", if f[0][0] == 1 { "black" } else { "white" } ); } #[allow(dead_code)] struct Scanner { stdin: io::Stdin, buffer: VecDeque, } #[allow(dead_code)] impl Scanner { fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } } fn reserve(&mut self) { while self.buffer.len() == 0 { let mut line = String::new(); let _ = self.stdin.read_line(&mut line); for w in line.split_whitespace() { self.buffer.push_back(String::from(w)); } } } fn cin(&mut self) -> T { self.reserve(); match self.buffer.pop_front().unwrap().parse::() { Ok(a) => a, Err(_) => panic!("parse err") } } fn get_char(&mut self) -> char { self.reserve(); let head = self.buffer[0].chars().nth(0).unwrap(); let tail = String::from( &self.buffer[0][1..] ); if tail.len()>0 { self.buffer[0]=tail } else { self.buffer.pop_front(); } head } }