Mita’s team had always been a good team when it came to competitive programming, and this year, their hard work and dedication had finally paid off. They got selected for the ICPC regional competition. It was a momentous occasion, and they knew they had to give it their all to succeed.
In preparation for the upcoming ICPC regional competition, Mita’s team decided to engage in friendly practice sessions. In one practice contest, they found an interesting problem about two players passing through two paths having obstacles.
The problem statement is as follows:
Two paths having points are given for players and . Both players will start traveling at the same time from point . These paths contain obstacles at different points. If any player encounters an obstacle at an even-numbered point, they must move back step, while encountering an obstacle at an odd-numbered point requires them to move back steps. Once a player encounters an obstacle, it becomes inactive and will not impact that player’s move again. Traveling to every point requires second.
The player who reaches point before another player will win the game. If both players reach point N at the same time, the game is considered a tie.
As you are one of the teammates, help your teammates determine who will win the game or whether the game will be tied.
It is guaranteed that there are no obstacles at points and .
The first line provides a single integer , which represents the number of points on two paths. The second line consists of two integers, and . These indicate the number of obstacles on the paths for players and respectively. The third line contains integers, , representing the positions of obstacles on player path. The fourth line contains integers, , representing the positions of obstacles on player path.
For each test case print without quote if player wins the game, or print without quote if player wins the game, or print without quote if the game is tied.
Input | Output |
---|---|
10 2 4 2 4 2 5 6 9 | A |
For the first test case, let's simulate the moves for player :
From this point on, player path has no obstacles. Player reaches point 10 in a total of 13 seconds. In the same way, Player reaches point 10 in a total of 21 seconds. Since, player reaches point 10 before player , therefore, the output is because Player wins the game. |
Input | Output |
---|---|
10 4 2 2 5 6 9 2 4 | B |
Input | Output |
---|---|
10 4 4 2 5 6 9 2 5 6 9 | DRAW |
Be careful about the newline(‘\n’) at the end.