n,q = map(int,input().split())
S = input()
dp = [[0]*26]
for s in S:
    ndp = [0]*26
    ndp[ord(s)-ord("a")] += 1
    for i in range(26):
        ndp[i] += dp[-1][i]
    dp.append(ndp)

for i in range(q):
    l,r,x = map(int,input().split())
    count = 0
    for j in range(26):
        count += dp[r][j]-dp[l-1][j]
        if count >= x:
            print(chr(ord("a")+j))
            break