N,Q = map(int,input().split()) S = input() lsalpha = 'abcdefghijklmnopqrstuvwxyz' d = dict() for i in range(26): d[lsalpha[i]] = i ll = [] for i in range(N): ll.append(d[S[i]]) lsQ = [] for i in range(Q): l,r,x = map(int,input().split()) l -= 1 lsQ.append((l,r,x)) la = [[0]*(N+1) for i in range(26)] for i in range(26): for j in range(N): la[i][j+1] = la[i][j]+(i==ll[j]) for i in range(Q): l,r,x = lsQ[i] c = 0 v = 0 for j in range(26): c += la[j][r]-la[j][l] if c >= x: v = j break print(lsalpha[v])