import bisect n,q = map(int,input().split()) s = input() lrx = [[int(i)-1 for i in input().split()] for j in range(q)] sli = [0]*(n) for i in range(n): sli[i] = ord(s[i]) for i in range(q): l,r,x = lrx[i][0],lrx[i][1],lrx[i][2] tmp = sli[l:r+1] #print(tmp) #for j in range(r-l+1): # tmp.append(sli[l+j]) tmp.sort() print(chr(tmp[x]))