#include #include #include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = long long; using u32 = uint32_t; using namespace std; template constexpr T INF = ::numeric_limits::max() / 32 * 15 + 208; int main() { ll n, k, q; cin >> n >> k >> q; vector ans(k); ll rem = n*n, cnt1 = n, cnt2 = n; vector used1(n), used2(n); vector> v(q); for (int i = 0; i < q; ++i) { char x; int a, b; scanf(" %c %d %d", &x, &a, &b); v[i] = {x, a-1, b-1}; } reverse(v.begin(),v.end()); for (int i = 0; i < q; ++i) { char c; int a, b; tie(c, a, b) = v[i]; if(c == 'R'){ if(used1[a]) continue; used1[a] = 1; cnt1--; ans[b] += cnt2; rem -= cnt2; }else { if(used2[a]) continue; used2[a] = 1; cnt2--; ans[b] += cnt1; rem -= cnt1; } } ans[0] += rem; for (int i = 0; i < k; ++i) { printf("%lld\n", ans[i]); } return 0; }