#line 1 "main.cpp" #include #include #include #include #include using namespace std; using lint = long long; void solve() { int n, q; cin >> n >> q; vector> cnt(n + 1, vector(26, 0)); for (int i = 1; i <= n; ++i) { cnt[i] = cnt[i - 1]; char c; cin >> c; ++cnt[i][c - 'a']; } while (q--) { int l, r, x; cin >> l >> r >> x; --l; for (int c = 0; c < 26; ++c) { auto pcnt = cnt[r][c] - cnt[l][c]; if (x <= pcnt) { cout << char('a' + c) << "\n"; break; } x -= pcnt; } } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }