# 1471 Sort Queries from sys import stdin n,q=list(map(int,stdin.readline().split())) s=tuple(stdin.readline().rstrip()) for _ in range(q): l,r,x=list(map(int,stdin.readline().split())) subS=sorted(s[l-1:r-1+1]) print(subS[x-1])