#include #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--) #define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++) #define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--) #define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++) #define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++) #define ALL(x) x.begin(), x.end() using ll = long long; using namespace std; int main() { int n, q; cin >> n >> q; string s; cin >> s; vector csums(26, vector(n+1, 0)); rep(i, n) { int idx = s.at(i) - 'a'; csums.at(idx).at(i+1)++; rep(j, 26) csums.at(j).at(i+1) += csums.at(j).at(i); } while(q--) { int x, l, r; cin >> l >> r >> x; l--; rep(i, 26) { const auto &v = csums.at(i); x -= v.at(r) - v.at(l); // cerr << q << " " << x << endl; if(x <= 0) { char ans = 'a' + i; cout << ans << endl; break; } } } return 0; }