Problems
In a game of Hoof Paper Scissors, Bessie and Elsie can put out one of
One symbol wins and the other loses.
The symbols draw against each other.
Hoof Paper Scissors Minus One works similarly, except Bessie and Elsie can each put out two symbols, one with each hoof. After observing all four symbols that they have all put out, they each choose one of their two symbols to play. The outcome is decided based on normal Hoof Paper Scissor conventions.
Given the
Input
The first line contains two space-separated integers
Out of the following
The next
Output
Output
Example
3 3
D
WD
LWD
1 2
2 3
1 1
0
0
5
In this example, this corresponds to the original Hoof Paper Scissors and we can let Hoof=1, Paper=2, and Scissors=3. Paper beats Hoof, Hoof beats Scissors, and Scissors beats Paper. There is no way for Bessie to guarantee a win against the combinations of Hoof+Paper or Paper+Scissors. However, if Elsie plays Hoof+Hoof, Bessie can counteract with any of the following combinations.
Paper+Paper
Paper+Scissors
Paper+Hoof
Hoof+Paper
Scissors+Paper
If Bessie plays any of these combinations, she can guarantee that she wins by putting forward Paper.