#include<iostream>
#include<vector>
int compare(int a, int b)
{
if (a == b)
return 0;
if (a == 5 && b == 2)
return -1;
if (a == 5 && b == 0)
return 1;
if (a == 2 && b == 5)
return 1;
if (a == 2 && b == 0)
return -1;
if (a == 0 && b == 2)
return 1;
if (a == 0 && b == 5)
return -1;
}
using namespace std;
int main()
{
int A_win_number=0;
int B_win_number = 0;
vector<int> A;
vector<int> B;
vector<int> AA;
vector<int> BB;
int N, NA, NB;
cin >> N >> NA >> NB;
for (int i = 0; i < NA; ++i)
{
int a;
cin >> a;
AA.push_back(a);
}
for (int i = 0; i < NB; ++i)
{
int b;
cin >> b;
BB.push_back(b);
}
for (int i = 0; i < N; ++i)
{
A.push_back(AA[i%NA]);
B.push_back(BB[i%NB]);
}
for (int i = 0; i < N; ++i)
{
if (compare(A[i], B[i])==1)
++A_win_number;
if (compare(A[i], B[i]) == -1)
++B_win_number;
}
if (A_win_number > B_win_number)
cout << "A";
else if (A_win_number == B_win_number)
cout << "draw";
else
cout << "B";
return 0;
}