Problem:
Score : 300 points

Problem Statement

A game is played on a strip consisting of N cells consecutively numbered from 1 to N.

Alice has her token on cell A. Borys has his token on a different cell B.

Players take turns, Alice moves first.
The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1.
Note that it's disallowed to move the token outside the strip or to the cell with the other player's token.
In one turn, the token of the moving player must be shifted exactly once.

The player who can't make a move loses, and the other player wins.

Both players want to win. Who wins if they play optimally?

Constraints

2 \leq N \leq 100

1 \leq A < B \leq N

All input values are integers.

Input

Input is given from Standard Input in the following format:

N A B

Output

Print Alice if Alice wins, Borys if Borys wins, and Draw if nobody wins.

Sample Input 1

5 2 4

Sample Output 1

Alice

Alice can move her token to cell 3.
After that, Borys will be unable to move his token to cell 3, so he will have to move his token to cell 5.
Then, Alice moves her token to cell 4. Borys can't make a move and loses.

Sample Input 2

2 1 2

Sample Output 2

Borys

Alice can't make the very first move and loses.

Sample Input 3

58 23 42

Sample Output 3

Borys

Solution in C++14 (GCC 5.4.1) (judge verdict: Time Limit Exceeded)

#include<bits/stdc++.h>
using namespace std; 
#define ll long long
#define rep(i,x,y)  for(ll i=x;i<y;++i)
#define For(i,x,y)  for(ll i=x;i<=y;++i) 
#define FOr(i,x,y)  for(ll i=x;i>=y;--i) 
#define pi acos(-1)
#define mk make_pair<ll,ll>
#define pa pair<ll,ll>
#define lf else if
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)		(x)*(x)
#define abs(x)		(x)>0?(x):-(x)
#define Mul(x,y)    x=x*(y)%mod
#define Add(x,y)    x=(x+(y))%mod
#define Max(x,y)	x=x<(y)?(y):x
#define Min(x,y)	x=x>(y)?(y):x
#define E(x) 		return writeln(x),0
#define p(x)		printf("~%d~\n",x)
#define pp(x,y)		printf("~~%d %d~~\n",x,y)
#define ppp(x,y,z)	printf("~~~%d %d %d~~~\n",x,y,z)
#define f_in(x)		freopen(x".in","r",stdin)
#define f_out(x) 	freopen(x".out","w",stdout)
#define open(x)		f_in(x),f_out(x)
#define fi first
#define se second
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_;
#endif 
#define NEG 0
    const int L=2333333;
    char SZB[L],*S=SZB,*T=SZB;
    inline char gc(){   if (S==T){  T=(S=SZB)+fread(SZB,1,L,stdin); if (S==T) return '\n';  }   return *S++;    }
#if NEG
    inline ll read(){    ll x=0,f=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') f=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*f; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
    inline void writeln(ll x){  write(x);   puts("");   }
}using namespace SHENZHEBEI;
ll Q,A,B,x,y,q[10000],top,one;
ll calc(ll x){
	ll sizeof_A=x-x/(one+1)+(A+B-x)/(one+1);
	return sizeof_A;
}
ll get(ll x){
	ll ans=x%(one+1),ans1=x%(one+1)==0;
	if (x==A+B)	return ans;	++x;	x=(A+B-x+1);
	ans+=x%(one+1)==0,ans1+=x%(one+1);
	return max(ans,ans1);
}
void work1(){
//Ag个分成B+1分, 
	one=(A-1)/(B+1)+1/*答案*/;
	ll l=0,r=A+B,ans=0;
	while(l<=r){
		ll mid=(l+r)>>1;
		if (calc(mid)<=A)	l=mid+1,ans=mid;
		else	r=mid-1;
	}
	For(i,x,y){
		if (i<=ans)	putchar(i%(one+1)==0?'B':'A'); 
		else	putchar((A+B-i+1)%(one+1)==0?'A':'B');
	}
}
void work2(){
	swap(A,B);	x=(A+B+1)-x;	y=(A+B+1)-y;	swap(x,y);	top=0;
	one=(A-1)/(B+1)+1/*答案*/;
	ll l=0,r=A+B,ans=0;
	while(l<=r){
		ll mid=(l+r)>>1;
		if (calc(mid)<=A)	l=mid+1,ans=mid;
		else	r=mid-1;
	}
	while(ans<A+B){
		if (calc(ans+1)<=A){	ans++;	continue;	}
		if (ans+2>A+B)	break;
		if (calc(ans+2)<=A){	ans++;	continue;	}
		if (ans+3>A+B)	break;
		if (calc(ans+3)<=A){	ans++;	continue;	}
		if (ans+4>A+B)	break;
		if (calc(ans+4)<=A){	ans++;	continue;	}
		break;
	}
	while(ans&&(get(ans)>one||calc(ans)>A))--ans;
	For(i,x,y){
		if (i<=ans)	q[++top]=i%(one+1)==0?'B':'A'; 
		else	q[++top]=(A+B-i+1)%(one+1)==0?'A':'B';
	}
	while(top)	putchar('A'+'B'-q[top--]);
}
int main(){
	Q=read();
	while(Q--){
		A=read(),B=read();	x=read(),y=read();
		if (A>=B)	work1();
		else	work2();
		puts("");
	}
}
/*
*/