#include using namespace std; int n, q; string s; vector> cnt; int main() { cin >> n >> q >> s; cnt.resize(26, vector(n + 1, 0)); for (int i = 0; i < n; ++i) { for (int j = 0; j < 26; ++j) cnt[j][i + 1] = cnt[j][i]; ++cnt[s[i] - 'a'][i + 1]; } while (q--) { int l, r, x; cin >> l >> r >> x; vector v(26); --l; for (int i = 0; i < 26; ++i) v[i] = cnt[i][r] - cnt[i][l]; char res; for (int i = 0; i < 26; ++i) { x -= v[i]; if (x <= 0) { res = 'a' + i; break; } } cout << res << endl; } return 0; }