#include <bits/stdc++.h>
using namespace std;
int main( ) {
int n,q; cin >> n >> q;
vector < string> v;
vector < vector < int > > pref( n+ 1 , vector < int > ( 26 ,0 ) ) ; // pref[i][j] -> it means that cumulative frquency of characters from 'a' to 'z' is being stored till ith index
for ( int i = 0 ; i < n; i++ ) {
string s; cin >> s;
v.push_back ( s) ;
for ( int j = 0 ; j < s.length ( ) ; j++ ) {
pref[ i+ 1 ] [ s[ j] - 'a' ] ++ ;
}
}
for ( int i = 2 ; i < n+ 1 ; i++ ) {
for ( int j = 0 ; j < 26 ; j++ ) pref[ i] [ j] + = pref[ i- 1 ] [ j] ;
}
while ( q-- ) {
int l,r,k; cin >> l >> r >> k;
int cnt = 0 ;
char op;
for ( int i = 0 ; i < 26 ; i++ ) {
cnt + = pref[ r] [ i] - pref[ l- 1 ] [ i] ;
if ( cnt >= k) {
op = i+ 97 ;
break ;
}
}
cout << op << "\n " ;
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCBuLHE7IGNpbiA+PiBuID4+IHE7Cgl2ZWN0b3IgPHN0cmluZz4gdjsKCXZlY3RvciA8dmVjdG9yIDxpbnQ+ID4gcHJlZihuKzEsIHZlY3RvciA8aW50PigyNiwwKSk7IC8vIHByZWZbaV1bal0gLT4gaXQgbWVhbnMgdGhhdCBjdW11bGF0aXZlIGZycXVlbmN5IG9mIGNoYXJhY3RlcnMgZnJvbSAnYScgdG8gJ3onIGlzIGJlaW5nIHN0b3JlZCB0aWxsIGl0aCBpbmRleAoJZm9yKGludCBpID0gMDsgaSA8IG47IGkrKykgewoJCXN0cmluZyBzOyBjaW4gPj4gczsKCQl2LnB1c2hfYmFjayhzKTsKCQkKCQlmb3IoaW50IGogPSAwOyBqIDwgcy5sZW5ndGgoKTsgaisrKSB7CgkJCXByZWZbaSsxXVtzW2pdLSdhJ10rKzsKCQl9Cgl9CgkKCWZvcihpbnQgaSA9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