#include "bits/stdc++.h" //#define int long long using namespace std; using ll = long long; using P = pair; const ll INF = (1LL << 61); ll mod = 1000000007; signed main() { ios::sync_with_stdio(false); cin.tie(0); ll N, Q; cin >> N >> Q; string S; cin >> S; vector>sum(26, vector(N + 1)); for (int i = 0; i < 26; i++) { for (int j = 0; j < N; j++) { sum[i][j + 1] = sum[i][j]; if (S[j] - 'a' == i)sum[i][j + 1]++; } } for (int _ = 0; _ < Q; _++) { ll L, R, X; cin >> L >> R >> X; L--; ll t = 0; for (int i = 0; i < 26; i++) { ll now = sum[i][R] - sum[i][L]; t += now; if (t >= X) { cout << (char)('a' + i) << endl; break; } } } return 0; }