#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair P; #define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++) #define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++) #define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--) #define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--) const ll INF = 1145141919; const ll MOD = 1000000007; template void chmax(T &a, const T &b){if(a < b){a = b;}} template void chmin(T &a, const T &b){if(a > b){a = b;}} template bool find_from_set(set &S, const T &t){ return S.find(t) != S.end(); } int main(){ ll N, K, Q; cin >> N >> K >> Q; vectorans(K + 1, 0); vectorA(Q); vectorB(Q), C(Q); ans[1] = N * N; rep(i, Q)cin >> A[i] >> B[i] >> C[i]; setC_set, R_set; rrep(i, Q){ if(A[i] == 'C' && !find_from_set(C_set, B[i])){ C_set.insert(B[i]); ll tmp = N - R_set.size(); ans[1] -= tmp; ans[C[i]] += tmp; } if(A[i] == 'R' && !find_from_set(R_set, B[i])){ R_set.insert(B[i]); ll tmp = N - C_set.size(); ans[1] -= tmp; ans[C[i]] += tmp; } } rep1(i, K)printf("%lld\n", ans[i]); return 0; }