#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int co[10010][30] = {}; int main() { int n, q; cin >> n >> q; string s; cin >> s; for (int i = 1; i <= n; i++) { co[i][int(s[i - 1] - 'a')]++; for (int j = 0; j < 26; j++) { co[i][j] += co[i - 1][j]; } } for (int i = 0; i < q; i++) { int l, r, x; cin >> l >> r >> x; int co1 = 0; for (int j = 0; j < 26; j++) { if (x <= co1 + co[r][j] - co[l - 1][j]) { cout << char('a' + j) << endl; break; } else { co1 += co[r][j] - co[l - 1][j]; } } } }