from collections import defaultdict n,m = map(int,input().split()) s = list(map(str,input())) ss = sorted(s) d = defaultdict(list) for i in range(26): d[chr(97+i)].append(0) for j in range(n): if(s[j] == chr(97+i)): d[chr(97+i)].append(d[chr(97+i)][-1] + 1) else: d[chr(97+i)].append(d[chr(97+i)][-1]) for _ in range(m): a,b,c = map(int,input().split()) cnt = 0 for key in d: cnt += d[key][b] - d[key][a-1] if(cnt >= c): print(key) break