#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; constexpr int INF = 1001001001; constexpr int mod = 1000000007; // constexpr int mod = 998244353; template inline bool chmax(T& x, T y){ if(x < y){ x = y; return true; } return false; } template inline bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N, K, Q; cin >> N >> K >> Q; vector A(Q); vector B(Q), C(Q); for(int i = 0; i < Q; ++i) cin >> A[i] >> B[i] >> C[i]; vector used_row(N + 1), used_column(N + 1); int row_sum = 0, column_sum = 0; vector ans(K + 1); for(int i = Q - 1; i >= 0; --i){ if(A[i] == 'R'){ if(used_row[B[i]]) continue; used_row[B[i]] = true; row_sum += 1; ans[C[i]] += N - column_sum; } else{ if(used_column[B[i]]) continue; used_column[B[i]] = true; column_sum += 1; ans[C[i]] += N - row_sum; } } ll sum = 0; for(int i = 1; i <= K; ++i) sum += ans[i]; ans[1] += (ll)N * N - sum; for(int i = 1; i <= K; ++i) cout << ans[i] << '\n'; return 0; }