import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int k = sc.nextInt(); int q = sc.nextInt(); long total = (long)n * n; boolean[] isRows = new boolean[q]; int[] nums = new int[q]; int[] colors = new int[q]; for (int i = 0; i < q; i++) { isRows[i] = (sc.next().charAt(0) == 'R'); nums[i] = sc.nextInt(); colors[i] = sc.nextInt() - 1; } int rowCount = n; int colCount = n; HashSet rowUsed = new HashSet<>(); HashSet colUsed = new HashSet<>(); long[] counts = new long[k]; for (int i = q - 1; i >= 0; i--) { if (isRows[i]) { if (rowUsed.contains(nums[i])) { continue; } rowUsed.add(nums[i]); rowCount--; counts[colors[i]] += colCount; total -= colCount; } else { if (colUsed.contains(nums[i])) { continue; } colUsed.add(nums[i]); colCount--; counts[colors[i]] += rowCount; total -= rowCount; } } counts[0] += total; StringBuilder sb = new StringBuilder(); for (long x : counts) { sb.append(x).append("\n"); } System.out.print(sb); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }