Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the world? Are you busy? Will you save us?".
She wants to let more people know about it, so she defines fi = "What are you doing while sending "fi - 1"? Are you busy? Will you send "fi - 1"?" for all i ≥ 1.
For example, f1 is
"What are you doing while sending "What are you doing at the end of the world? Are you busy? Will you save us?"? Are you busy? Will you send "What are you doing at the end of the world? Are you busy? Will you save us?"?". Note that the quotes in the very beginning and in the very end are for clarity and are not a part of f1.
It can be seen that the characters in fi are letters, question marks, (possibly) quotation marks and spaces.
Nephren will ask the little leprechauns q times. Each time she will let them find the k-th character of fn. The characters are indexed starting from 1. If fn consists of less than k characters, output '.' (without quotes).
Can you answer her queries?
The first line contains one integer q (1 ≤ q ≤ 10) — the number of Nephren's questions.
Each of the next q lines describes Nephren's question and contains two integers n and k (0 ≤ n ≤ 105, 1 ≤ k ≤ 1018).
One line containing q characters. The i-th character in it should be the answer for the i-th query.
3 1 1 1 2 1 111111111111
Wh.
5 0 69 1 194 1 139 0 47 1 66
abdef
10 4 1825 3 75 3 530 4 1829 4 1651 3 187 4 584 4 255 4 774 2 474
Areyoubusy
For the first two examples, refer to f0 and f1 given in the legend.
#include<bits/stdc++.h>
#define ll long long
#define maxn 100010
#define INF 1e18
using namespace std;
char s1[maxn]=" What are you doing at the end of the world? Are you busy? Will you save us?";//为了方便计算在开头加了一个空格
char s2[maxn]=" What are you doing while sending \"\"? Are you busy? Will you send \"\"?";//为了方便计算在开头加了一个空格
ll f[maxn],i;
char ans[15];
char slove(ll x,ll y)
{
if(y>f[x]&&x<=i)//超出范围
return '.';
if(x==0)//在f[0]中
return s1[y];
if(y<=34)//在s2中的 What are you doing while sending" 一段中
return s2[y];
if(y<=34+f[x-1]||x>i)//在上一层
return slove(x-1,y-34);
if(y<=34+f[x-1]+32)//在s2中的 "? Are you busy? Will you send \" 一段中
return s2[y-f[x-1]];
if(y<=34+2*f[x-1]+32)//在上一层
return slove(x-1,y-34-f[x-1]-32);
return s2[y-2*f[x-1]];//在s2中的 "? 一段中
}
int main()
{
// std::ios::sync_with_stdio(false);
// cin.tie(0);cout.tie(0);
f[0]=strlen(s1)-1;
i=1;
while(1)//计算每一层的字符个数
{
f[i]=2*f[i-1]+68;
if(f[i]>INF)
break;
i++;
}
int n;
scanf("%d",&n);
while(n--)
{
ll a,b;
scanf("%lld%lld",&a,&b);
cout<<slove(a,b);
}
return 0;
}