N, Q = map(int, input().split()) S = input() alpha =['a','b','c','d','e','f','g','h','i','j','k','l','m','n', 'o','p','q','r','s','t','u','v','w','x','y','z'] data = [[[0] for k in range(26)] for _ in range(int(N*(N+1)/2))] for i in range(N): for j in range(i,N): for k in range(26): c = S.count(alpha[k], i, j+1) data[int(N*i+j-i*(i+1)/2)][k] = c for i in range(Q): l, r, x = list(map(int, input().split())) d = data[int(N*(l-1)+r-1-l*(l-1)/2)][0] for j in range(26): if d >= x: print(alpha[j]) break d += data[int(N*(l-1)+r-1-l*(l-1)/2)][j+1]