from sys import stdin def main(): input = lambda: stdin.readline()[:-1] N, Q = map(int, input().split()) S = input() for _ in [0] * Q: L, R, X = map(int, input().split()) s = sorted(S[L - 1 : R]) print(s[X - 1]) main()