#include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; #define rep(i,n) for(ll i=0;i T div_floor(T a, T b) { return a / b - ((a ^ b) < 0 && a % b); } template T div_ceil(T a, T b) { return a / b + ((a ^ b) > 0 && a % b); } template inline bool chmin(T &x, U y) { return (y < x) ? (x = y, true) : false; } template inline bool chmax(T &x, U y) { return (x < y) ? (x = y, true) : false; } void solve() { ll N,Q; cin>>N>>Q; string S; cin>>S; const ll INF=4e18; vector> turn_len_sum(60,vector (N+1,0)); auto lenT=[](ll t)->ll { if (t>=60){ return INF; } else{ return (1LL<char { chmin(t,59); assert (ichar { chmin(t,59); assert (i>t>>x; chmin(t,59); x--; ll ok=0; ll ng=N+1; while (ng-ok>1){ ll mid=(ok+ng)/2; if (turn_len_sum[t][mid]<=x){ ok=mid; } else{ ng=mid; } } x-=turn_len_sum[t][ok]; if (S[ok]=='w'){ ans.push_back(wstr(wstr,astr,t,x)); } else if (S[ok]=='a'){ ans.push_back(astr(wstr,astr,t,x)); } else{ ans.push_back(S[ok]); } } cout<