#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using mint = modint998244353; int main() { int N, Q, L, R, X; cin >> N >> Q; string T; cin >> T; vector> S(26, vector(N + 1)); for (int i = 1; i <= N; i++) { S[T[i - 1] - 'a'][i]++; for (int j = 0; j < 26; j++) S[j][i] += S[j][i - 1]; } while (Q--) { cin >> L >> R >> X; for (int i = 0; i < 26; i++) { X -= S[i][R] - S[i][L - 1]; if (X <= 0) { cout << char(i + 'a') << endl; break; } } } return 0; }