import sys sys.set_int_max_str_digits(0) from bisect import bisect_left, bisect_right from collections import deque, defaultdict, Counter from itertools import product, combinations, permutations, groupby, accumulate from heapq import heapify, heappop, heappush N, Q = map(int, input().split()) S = input() cnt = [[0] * (N + 1) for _ in range(26)] for i, s in enumerate(S): cnt[ord(s) - 97][i + 1] += 1 for s in range(26): for i in range(N): cnt[s][i + 1] += cnt[s][i] ansl = [] for _ in range(Q): l, r, x = map(int, input().split()) memo = 0 ans = 'a' for s in range(26): # cnt[s][r] - cnt[s][l - 1] memo += cnt[s][r] - cnt[s][l - 1] # びったりかオーバーランしたらその文字 if memo >= x: ans = chr(97 + s) break ansl.append(ans) print(*ansl, sep='\n')