from sys import stdin input=lambda :stdin.readline()[:-1] debug=0 if debug: import random from collections import deque if debug: N,M,Q=10,10,10 else: N,M,Q=map(int,input().split()) memo=[deque() for i in range(M+1)] for i in range(M+1): memo[i].append(0) P,S=[0]*N,[0]*N for i in range(N): if debug: P[i]=random.randint(1,M) if random.randint(1,2)==1: S[i]='AC' else: S[i]='WA' else: P[i],S[i]=input().split() P[i]=int(P[i]) m=int(Q**0.5)+1 bucket=[[] for i in range(m)] if debug: print(P) print(S) for i in range(Q): if debug: l=random.randint(0,N-1) r=random.randint(0,N-1) print(l,r) if rl: L-=1 AddL(L) while R>r: DelR(R) R-=1 while L