from itertools import accumulate N, Q = map(int, input().split()) S = input() D = [[0] * (N + 1) for _ in range(26)] for i, s in enumerate(S,start = 1): D[ord(s) - 97][i] = 1 for i in range(26): D[i] = list(accumulate(D[i])) for _ in range(Q): l, r, x = map(int, input().split()) cnt = 0 for i in range(26): cnt += D[i][r] - D[i][l - 1] if x <= cnt: print(chr(97 + i)) break