#include using namespace std; using ll = long long; std::vector Ls; ll len(char c, int t) { if (c == 'a' || c == 'w') { return Ls[t]; } else { return 1; } } vector S(26); char calc(const string& s, int t, ll x) { if (x == 0) { return s[0]; } for (auto& c : s) { if (x < len(c, t)) { return calc(S[c - 'a'], t-1, x); } x -= len(c, t); } assert(false); } int main () { int N, Q; cin >> N >> Q; { ll fl = 1; int id = 0; while (fl <= (ll)1e18) { Ls.push_back(fl); fl += (1ll << id) * 5; id ++; } } for (int i = 0; i < 26; i ++) { S[i] = string(1, 'a' + (char)i); } S[0] = "answer"; S[22] = "warong"; string s; cin >> s; while (Q--) { ll t, x; cin >> t >> x; t = min(t, (ll)Ls.size() - 1); cout << calc(s, t, --x); } cout << endl; }