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