n, k, q = map(int, input().split()) s = [input().split() for _ in range(q)] r = [0]*k x, y = set(), set() for a, b, c in s[::-1]: b, c = int(b), int(c) if a == 'C': s, t = x, y else: s, t = y, x if b in t: continue t.add(b) r[c-1] += n-len(s) r[0] += n*n-sum(r) for i in r: print(i)