import bisect N, Q = map(int, input().split()) A = list(input()) I = [] J = [] K = [] for _ in range(Q): l, r, x = map(int, input().split()) I.append(l) J.append(r) K.append(x) n = 1 while n < N: n *= 2 dat = [[] for _ in range(n*2)] def init(k, l, r): if r - l == 1: dat[k].append(A[l]) else: lch = k * 2 + 1 rch = k * 2 + 2 init(lch, l, (l+r)//2) init(rch, (l+r)//2, r) dat[k] = sorted(dat[lch] + dat[rch]) def query(i, j, x, k, l, r): if j <= l or r <= i: return 0 elif i <= l and r <= j: return bisect.bisect_right(dat[k], x) else: lc = query(i, j, x, k * 2 + 1, l, (l+r)//2) rc = query(i, j, x, k * 2 + 2, (l+r)//2, r) return lc + rc nums = sorted(A) init(0, 0, N) for i in range(Q): l = I[i] - 1 r = J[i] k = K[i] lb, ub = -1, N - 1 while ub - lb > 1: md = (ub + lb) // 2 c = query(l, r, nums[md], 0, 0, N) if c >= k: ub = md else: lb = md print(nums[ub])