fn main() { use std::io::prelude::*; use std::io::{self, BufReader}; let cin = io::stdin(); let reader = BufReader::new(cin.lock()); let mut lines = reader.lines(); macro_rules! input { ($($x:ident : $t:ty), *) => { $(let $x: $t;)* { let s = lines.next().unwrap().unwrap(); let mut it = s.split_whitespace(); $($x = it.next().unwrap().parse().unwrap();)* assert!(it.next().is_none()); } }; } input!(n: usize, k: usize, q: usize); let mut a: Vec = Vec::new(); let mut b: Vec = Vec::new(); let mut c: Vec = Vec::new(); for _ in 0..q { input!(tmp_a: char, tmp_b: usize, tmp_c: usize); a.push(tmp_a); b.push(tmp_b - 1); c.push(tmp_c - 1); } let mut cnt: Vec = vec![0; k]; let mut used_row = vec![false; n]; let mut used_col = vec![false; n]; let mut left_row: i64 = n as i64; let mut left_col: i64 = n as i64; for i in (0..q).rev() { if a[i] == 'C' { if used_col[ b[i] ] { continue; } used_col[ b[i] ] = true; cnt[ c[i] ] += left_row; left_col -= 1; } else { if used_row[ b[i] ] { continue; } used_row[ b[i] ] = true; cnt[ c[i] ] += left_col; left_row -= 1; } } cnt[0] += left_row * left_col; for i in 0..k { println!("{}", cnt[i]); } }