#include using namespace std; int main() { // Your code here! int N, K, Q; char a[100000]; int b[100000], c[100000]; cin >> N >> K >> Q; for (int i = 0; i < Q; i++) { cin >> a[i] >> b[i] >> c[i]; } int color[100000] = { 0 }; int rowCnt = 0; int colCnt = 0; bool rowSet[100000] = { false }; bool colSet[100000] = { false }; long long baseColor = N * N; for (int i = Q - 1; i >= 0; i--) { int point = 0; if (a[i] == 'R' && rowSet[b[i] - 1] == false) { point = N - colCnt; rowSet[b[i]-1] = true; rowCnt++; } else if (a[i] == 'C' && colSet[b[i] - 1] == false) { point = N - rowCnt; colSet[b[i]-1] = true; colCnt++; } color[c[i]-1] += point; baseColor -= point; } cout << color[0] + baseColor << endl; for (int i = 1; i < K; i++) { cout << color[i] << endl; } return 0; }