t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
print('Alice' if max(a) >= max(b) else 'Bob')
print('Alice' if max(a) > max(b) else 'Bob')
#include<bits/stdc++.h>
#define int long long
#define sub substr
#define L(i,j,k) for(int i=(j);i<=(k);i++)
#define R(i,j,k) for(int i=(j);i>=(k);i--)
#define inf 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define pb push_back
#define MS(i,j) memset(i,j,sizeof (i))
#define T__ int T;cin>>T;while(T--){solve();}
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define dbg(x) system("color");cerr<<"\033[35;1m"<<#x<<" is "<<x<<"\n"<<"\033[39;0m";
using namespace std;
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
return x*f;
}
inline void print(int x) {
if(x<0){putchar('-');x=-x;}
if(x/10)print(x/10);
putchar(x%10+'0');
}
int gcd(int x,int y){if(y==0) return x;return gcd(y,x%y);}//�������
int lowbit(int x){return x&(-x);}
//lower_bound(a,a+n,x)-a ���ֲ���
//upper_bound(a,a+n,x)-a
int dx[5]={0,1,0,-1},dy[5]={1,0,-1,0};//����
struct node{
int w;
int v;
};
bool cmp(int a,int b){
return a > b;
}
/*bool cmp1(struct node u,struct node v){
return u.hao>v.hao;
}
bool cmp2(struct node u,struct node v){
return u.shi<v.shi;
}*/
bool cmpl(int u,int v){return u>v;}
struct cmps{
int x;
bool operator < (const cmps &a)const{ return a.x < x;/*return a.x > x;*/}
};
//vector<ll> v;
//priority_queue<cmps> sp;
//queue<ll> sq;
//stack<ll> st;
//map<ll,ll> mp;
//pair<ll,ll> p;
void solve(){
int n,m;
cin>>n;
int max1 = -1e18,max2 = -1e18;
L(i,1,n){
int x;
cin>>x;
max1 = max(max1,x);
}
cin>>m;
L(i,1,m){
int y;
cin>>y;
max2 = max(max2,y);
}
if(max1 == max2){
cout<<"Alice"<<"\n";
cout<<"Bob"<<"\n";
return;
}
if(max1 > max2){
cout<<"Alice"<<"\n";
cout<<"Alice"<<"\n";
return;
}else{
cout<<"Bob"<<"\n";
cout<<"Bob"<<"\n";
return;
}
}
signed main(){
IOS;
T__
//solve();
return 0;
}
1424G - Years | 1663A - Who Tested |
1073B - Vasya and Books | 195B - After Training |
455A - Boredom | 1099A - Snowball |
1651D - Nearest Excluded Points | 599A - Patrick and Shopping |
237A - Free Cash | 1615B - And It's Non-Zero |
1619E - MEX and Increments | 34B - Sale |
1436A - Reorder | 1363C - Game On Leaves |
1373C - Pluses and Minuses | 1173B - Nauuo and Chess |
318B - Strings of Power | 1625A - Ancient Civilization |
864A - Fair Game | 1663B - Mike's Sequence |
448A - Rewards | 1622A - Construct a Rectangle |
1620A - Equal or Not Equal | 1517A - Sum of 2050 |
620A - Professor GukiZ's Robot | 1342A - Road To Zero |
1520A - Do Not Be Distracted | 352A - Jeff and Digits |
1327A - Sum of Odd Integers | 1276A - As Simple as One and Two |