#include using namespace std; typedef long long ll; #define int ll #define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define pb emplace_back #define pii pair #define F first #define S second const int mod = 1000000007; const int MAXX = 1e6 + 5; int n , q , l , r , x; string s; signed main() { _FastIO; cin >> n >> q; cin >> s; vector > v; for(int i = 0; i < n; i++){ v.push_back({s[i] , i + 1}); } sort(v.begin() , v.end()); while(q--){ cin >> l >> r >> x; for(int i = 0; i < n; i++){ if(v[i].S >= l && v[i].S <= r){ x--; if(!x){ cout << v[i].F << endl; break; } } } } return 0; }