#include using namespace::std; const int N = 10000 + 5; const int E = 26; int n; int q; char s[N]; int ac[E][N]; void preprocess(){ for(int i = 1; i <= n; i++){ for(int j = 0; j < E; j++){ ac[j][i] = ac[j][i - 1]; } ac[s[i] - 'a'][i] += 1; } } char solve(int l, int r, int k){ int sum = 0; for(int i = 0; i < E; i++){ int here = ac[i][r] - ac[i][l - 1]; if(sum + here >= k) return i + 'a'; sum += here; } } int main(){ scanf("%d %d", &n, &q); scanf("%s", s + 1); preprocess(); int l, r, k; while(q--){ scanf("%d %d %d", &l, &r, &k); putchar(solve(l, r, k)); puts(""); } return 0; }