N,Q = map(int,input().split()) S = "0"+input().strip() C = {chr(i):[0 for _ in range(N+1)] for i in range(97,123)} for i in range(1,N+1): for j in range(97,123): C[chr(j)][i] = C[chr(j)][i-1] C[S[i]][i] += 1 for _ in range(Q): l,r,x = map(int,input().split()) cnt = 0 for j in range(97,123): n = C[chr(j)][r]-C[chr(j)][l-1] if cnt+n>=x: print(chr(j)) break cnt += n