As his name suggests, he is kind-hearted and cares about people's time. Unfortunately, there is a difference between the scholars! Professor Baqir (who is an experienced user) has made a whole point about the fact that he is the least powerful in the computer chess game. They jointly participated in the bank lottery and a bag inside
n
There are n coins, won. Unfortunately, they did not agree on the distribution of the coins, and now there is some disagreement between the scholars. Therefore, they have decided to start a game and give sweets to the winner of the competition, because he won the competition! The game is like this:

Professor Baqir one number
p
chooses p. A monkey is also a number
q
q chooses. Now two people take turns playing. Professor Baqer in his turn, if at least
p
p coin was present in the bag, it should be equal to the natural multiple of
p
P takes the coins from the bag and puts it in his pocket. If it is less than when Professor Baqer's turn comes
p
p coins in the bag, the professor has to exactly
p
p puts a coin from his pocket into the bag. The movement of the monkey is the same, with the difference that the monkey moves instead
p
p, from
q
uses q. The winner of the race is the one who empties the bag of coins. (So ​​the game stops when there are no coins in the bag.) Since giving candy to friends is a very pleasant thing to do, everyone tries to win the game. Therefore, each of them will play their game in the best possible way. The first turn is with the professor.

Unfortunately, because the game is about money, some unemployed people who passed by it thought that the game was very important and that's why they started watching the game. Some of them also sold tickets to watch the game!! Mr. Khoshqalb, who was passing by and saw this incident, decided to make the game boring for everyone by telling them who would win, so that they would rather go about their lives scattered. (Everyone trusts Mr. Good-hearted like their eyes, that's why his words are a document!) Then, this is where people deviate from the game and become fascinated by Mr. Good-hearted (because of his predictions) and ask him to make predictions for them again. the people
t
Another scenario is given to Mr. Khoshqalb and they ask him to be the winner. That is, they ask him who would be the winner if the numbers of the professor and the monkey and the initial number of coins in the bag were other numbers. It is here that because Mr. Khoshqalb is not capable of these predictions, he says: O powerful racer, give this powerless one!! (says you)

input
In the first line of the input
t
t stands for the number of scenarios. in
t
t Next line, in each line, there is information of a scenario:

In each line that belongs to a scenario, three numbers respectively
p
p and
q
q and
n
n comes with a space, which represents the professor's choice number, the monkey's choice number and the initial number of coins in the bag, respectively.

1
≤
t
≤
1000
1≤t≤1000
1
≤
n
,
p
,
q
≤
1000

000

000
1≤n,p,q≤1000 000 000

output
Output included
t
t line is that in the line
i
i, should predict according to the scenario
i
i to be output. The output of each scenario is one of the following three modes:

PW: If Professor Bagher wins the game.
MW: If the monkey wins the game.
DW: If the game continues indefinitely without anyone winning the game
Example
Sample input
4
3 2 1
2 3 1
3 4 5
2 4 3
Plain text
Sample output
MW
MW
PW
DW
Plain text
Explanation of the first scenario: the number of coins is equal to 1, which is less than 3. Therefore, Professor Bagher has to add 3 to the number of coins in the bag. Here the number of coins becomes 4 and the monkey can empty the bag by picking 4 (which is a multiple of 2) coins and wins. c++