local n, q = io.read("*n", "*n", "*l") local s = io.read() local t = {} for i = 1, 26 do t[i] = {0} end for i = 1, n do local b = s:byte(i) - 96 for j = 1, 26 do if b == j then t[j][i + 1] = t[j][i] + 1 else t[j][i + 1] = t[j][i] end end end for iq = 1, q do local l, r, x = io.read("*n", "*n", "*n") for i = 1, 26 do local z = t[i][r + 1] - t[i][l] if x <= z then print(string.char(96 + i)) break end x = x - z end end