#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; ll N, K, Q; ll b[1000005], c[1000005], ans[1000005]; ll row, col; char a[1000005]; bool used_row[1000005], used_col[100005]; int main(void){ cin >> N >> K >> Q; row = col = 0; for (int i = 0; i < Q; i++){ cin >> a[i] >> b[i] >> c[i]; b[i]--; c[i]--; } for (int i = 0; i < N; i++){ used_row[i] = used_col[i] = false; } for (int i = 0; i < K; i++) ans[i] = 0; for (int i = Q - 1; i >= 0; i--){ if (a[i] == 'R'){ if (used_row[b[i]]) continue; ans[c[i]] += N - col; row++; used_row[b[i]] = true; } else{ if (used_col[b[i]]) continue; ans[c[i]] += N - row; col++; used_col[b[i]] = true; } } ans[0] += N*N - N*(row + col) + row*col; for (int i = 0; i < K; i++) cout << ans[i] << endl; }