N,Q = map(int,input().split()) S = str(input()) SA = [] for i in range(26): s_temp = [0] moji = chr(i+97) for j in range(N): if S[j] == moji: temp = s_temp[-1] + 1 else: temp = s_temp[-1] s_temp.append(temp) SA.append(s_temp) #print(SA) for i in range(Q): l,r,x = map(int,input().split()) l-=1;r-=1 cnt = 0 for j in range(26): temp = SA[j][r+1] - SA[j][l] cnt += temp if cnt >= x: ans = chr(j+97) break print(ans)