n, q = map(int,input().split()) S = input() alp = [[0]*26 for _ in range(n+1)] for i,s in enumerate(S): i += 1 for j in range(26): alp[i][j] = alp[i-1][j] alp[i][ord(s)-ord("a")] += 1 for j in range(q): l, r, x = map(int,input().split()) now = 0 for i in range(26): now += alp[r][i]-alp[l-1][i] if now >= x: print(chr(i+ord("a"))) break