from collections import defaultdict def main(): N, K, Q = map(int, input().split()) ABC = (tuple(input().split()) for _ in [0] * Q) tile_r = defaultdict(int) tile_c = defaultdict(int) for a, b, c in ABC: b = int(b) c = int(c) if a == 'R': tile_r[b] = [c, N] for i in tile_c.keys(): tile_c[i][1] -= 1 elif a == 'C': tile_c[b] = [c, N] for i in tile_r.keys(): tile_r[i][1] -= 1 color = defaultdict(int) grey = N ** 2 for i, j in tile_c.values(): color[i] += j if i > 1: grey -= j for i, j in tile_r.values(): color[i] += j if i > 1: grey -= j print(grey) for i in range(2, K + 1): cnt = color.get(i, 0) + 1 print(color[i]) main()