import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int q = sc.nextInt(); boolean[] isRows = new boolean[q]; int[] idxes = new int[q]; int[] colors = new int[q]; for (int i = 0; i < q; i++) { isRows[i] = (sc.next().charAt(0) == 'R'); idxes[i] = sc.nextInt(); colors[i] = sc.nextInt() - 1; } HashSet rows = new HashSet<>(); HashSet cols = new HashSet<>(); long[] ans = new long[k]; for (int i = q - 1; i >= 0; i--) { if (isRows[i]) { if (!rows.contains(idxes[i])) { ans[colors[i]] += n - cols.size(); rows.add(idxes[i]); } } else { if (!cols.contains(idxes[i])) { ans[colors[i]] += n - rows.size(); cols.add(idxes[i]); } } } long total = 0; for (int i = 1; i < k; i++) { total += ans[i]; } ans[0] = (long)n * n - total; StringBuilder sb = new StringBuilder(); for (long x : ans) { sb.append(x).append("\n"); } System.out.print(sb); } }