mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline N, Q = map(int, input().split()) S = input().rstrip('\n') A = [ord(s) - 97 for s in S] cs = [[0] * (N+1) for _ in range(26)] for i, a in enumerate(A): for j in range(26): if a == j: cs[j][i+1] = cs[j][i] + 1 else: cs[j][i+1] = cs[j][i] for _ in range(Q): l, r, x = map(int, input().split()) cnt = 0 for j in range(26): cnt += cs[j][r] - cs[j][l-1] if cnt >= x: print(chr(j + 97)) break if __name__ == '__main__': main()