import collections import sys def resolve(): readline = sys.stdin.readline n,q = map(int,readline().split()) s = readline().strip() seg = SegTree(s) deq = collections.deque() orda = ord('a') for i in range(q): l,r,x = map(int,readline().split()) result = 0 for chrid, chrsum in enumerate(seg.fold(l-1,r),orda): result += chrsum if x <= result: deq.append(chr(chrid)) break print(*deq,sep='\n') class SegTree: """ reffered to 'maspy', noncommutative operation is available X_f = min, X_unit = INF X_f = max, X_unit = -INF X_f = sum, X_unit = 0 X_f = lambda _,a,b: a+b, X_unit = '' """ orda = ord('a') X_f = lambda _,a,b:[ai+bi for ai,bi in zip(a,b)] def __init__(self, string): self.N = len(string) self.X = [[0]*26 for _ in range(self.N*2)] for i, c in enumerate(string,self.N): self.X[i][ord(c)-self.orda] = 1 for i in range(self.N - 1, 0, -1): self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1]) def fold(self, L, R):#[L,R) L += self.N R += self.N vL = [0]*26 vR = [0]*26 while L < R: if L & 1: vL = self.X_f(vL, self.X[L]) L += 1 if R & 1: R -= 1 vR = self.X_f(self.X[R], vR) L >>= 1 R >>= 1 return self.X_f(vL, vR) resolve()