#include using namespace std; #define repd(i,a,b) for (ll i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) #define all(x) (x).begin(),(x).end() template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } typedef long long ll; typedef pair P; typedef vector vec; using Graph = vector>; const long long INF = 1LL<<60; const long long MOD = 1000000007; // Mos algo //vectorはpush_backで // D=sqrt(q)+1; W=n/D+1; int D,W; struct Q{ int l,r,q; Q(int l,int r,int q):l(l),r(r),q(q){} bool operator<(const Q& a) const{ if(r/W!=a.r/W)return r/W>n>>q; string s;cin>>s; Graph g(26,vec(n+1)); rep(i,n){ g[s[i]-'a'][i+1]=1; } rep(i,26){ for(ll j=1;j<=n;j++){ g[i][j]+=g[i][j-1]; } } rep(qi,q){ ll l,r,x; cin>>l>>r>>x; l--; char ans; rep(i,26){ x-=g[i][r]-g[i][l]; if(x<=0){ ans='a'+i; break; } } cout<