#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 string solve(long long x,long long y,long long z,long long w,string s){ long long n = x+y; if(y==0){ if((z%2==0)==(s[0]=='E')){ return "Alice"; } else{ return "Bob"; } } if(w==0){ if((x%2==0)==(s[0]=='O'))cout<<"Alice"<0&&z>0){ string t = get(x-1,y,z-1,w,s,cur^1,turn^1); if(t[0]-'A'==turn)f = true; } if(x>0&&w>0){ string t = get(x-1,y,z,w-1,s,cur,turn^1); if(t[0]-'A'==turn)f = true; } if(y>0&&z>0){ string t = get(x,y-1,z-1,w,s,cur,turn^1); if(t[0]-'A'==turn)f = true; } if(y>0&&w>0){ string t = get(x,y-1,z,w-1,s,cur,turn^1); if(t[0]-'A'==turn)f = true; } if(f == (turn==0))return "Alice"; else return "Bob";{ } } int main(){/* int n; cin>>n; rep(i,n+1){ rep(j,n+1){ int x = i,y = n-i,z = j,w = n-j; if(x==0||z==0)continue; if(z-w<0||z-w>=2)continue; if(solve(x,y,z,w,"E") != get(x,y,z,w,"E")){ cout<>_t; rep(_,_t){ long long n; cin>>n; string s; cin>>s; long long x = 1LL; rep(j,60){ if(((n-1)>>j)&1)x*=2; } long long y = n-x; long long z = (n+1)/2; long long w = n-z; cout<