#include #include #include using lint = long long; void solve() { int n, k, m; std::cin >> n >> k >> m; std::vector> ts(m); for (auto& [t, x, c] : ts) { char tc; std::cin >> tc >> x >> c; t = (tc == 'C'); --x, --c; } std::reverse(ts.begin(), ts.end()); std::vector rows(n, false), cols(n, false); int rnum = n, cnum = n; std::vector ans(k, 0); for (auto [t, x, c] : ts) { switch (t) { case 0: { if (rows[x]) continue; ans[c] += cnum; rows[x] = true; --rnum; break; } case 1: { if (cols[x]) continue; ans[c] += rnum; cols[x] = true; --cnum; break; } } } ans[0] += lint(rnum) * cnum; for (auto a : ans) std::cout << a << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }