#include using namespace std; int main(){ int N, M, Q; cin >> N >> M >> Q; vector P(N); vector S(N); for (int i = 0; i < N; i++){ cin >> P[i] >> S[i]; P[i]--; } for (int i = 0; i < Q; i++){ int L, R; cin >> L >> R; L--; vector ac(M, false); vector wa(M, 0); int ans1 = 0; int ans2 = 0; for (int j = L; j < R; j++){ if (S[j] == "AC"){ if (!ac[P[j]]){ ans1++; ans2 += wa[P[j]]; ac[P[j]] = true; } } if (S[j] == "WA"){ wa[P[j]]++; } } cout << ans1 << ' ' << ans2 << endl; } }