#include using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) #define P pair int main() { int n, q; cin >> n >> q; string s; cin >> s; vector> v(26, vector(10005, 0)); vector> sum(26, vector(10005, 0)); rep(i, n) { v[s[i]-'a'][i] = 1; } rep(i, 26) { rep(j, n) { sum[i][j+1] = sum[i][j] + v[i][j]; } } rep(i, q) { int l, r, x; cin >> l >> r >> x; l--, r--; vector cnt(26); rep(j, 26) cnt[j] = sum[j][r+1] - sum[j][l]; int now = cnt[0]; int ind = 0; while (now < x) { ind++; now += cnt[ind]; } string ans; ans.push_back(ind+'a'); cout << ans << endl; } }