Paula and Marin are playing a game on a tree. Not on a real tree, of course. That would be dangerous. Although, who can say that a connected graph with
Before the game started, Paula colored some edges blue, and Marin colored some edges red. If some edge was colored by both, its final color is magenta. All edges were colored by at least one of them.
Paula's piece starts the game in node
Paula and Marin both play optimally. If they realize that the game can run forever, they will declare a draw. Determine the outcome of the game!
Input Specification
The first line contains an integer
The second line contains integers
The next x y color
, where x
and y
plava
(Croatian for blue), crvena
(Croatian for red) or magenta
.
Output Specification
Output Paula
if Paula will win, Marin
if Marin will win, or Magenta
if it's a draw.
Constraints
Subtask | Points | Constraints |
---|---|---|
1 | 30 | |
2 | 30 | All colors are magenta . |
3 | 50 | No additional constraints. |
Sample Input 1
3
1 3
3 2 magenta
2 1 magenta
Sample Output 1
Paula
Explanation for Sample Output 1
Paula will move to node
Sample Input 2
5
3 5
1 2 magenta
1 3 magenta
2 4 plava
2 5 crvena
Sample Output 2
Marin
Explanation for Sample Output 2
Paula must move to node
Sample Input 3
5
1 4
2 1 plava
1 3 crvena
5 2 plava
4 1 magenta
Sample Output 3
Magenta
Comments