#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(n); rep(i, n) v[i] = s[i]-'a'; rep(i, q) { int l, r, x; cin >> l >> r >> x; l--, r--, x--; vector subv; for (int j = l; j <= r; j++) subv.push_back(v[j]); sort(subv.begin(), subv.end()); string ans; ans.push_back(subv[x]+'a'); cout << ans << endl; } }