import sys input = sys.stdin.readline N, K, Q = map(int, input().split()) query = [] for i in range(Q): query.append(list(input().split())) query.reverse() Sc, Sr = set(), set() sum_c, sum_r = N, N ans = [0] * K for a, b, c in query: b, c = int(b) - 1, int(c) - 1 if a == "C": if b in Sc: continue ans[c] += sum_c sum_r -= 1 Sc.add(b) else: if b in Sr: continue ans[c] += sum_r sum_c -= 1 Sr.add(b) amari = N * N - sum(ans) ans[0] += amari for a in ans: print(a)