#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int sig = 26; int main() { fast_io(); int n, q; cin >> n >> q; string s; cin >> s; int cnt[n + 1][sig] = {}; for (int i = 0; i < n; i++) { for (int j = 0; j < sig; j++) { cnt[i + 1][j] = cnt[i][j]; } cnt[i + 1][s[i] - 'a']++; } for (; q--;) { int l, r, x; cin >> l >> r >> x; l--; char ans = 'a'; int cur = 0; for (int i = 0; i < sig; i++) { cur += cnt[r][i] - cnt[l][i]; if (cur >= x) { ans = i + 'a'; break; } } cout << ans << "\n"; } }