#P1839. Play with Power
Play with Power
Description
Masha and Stas are playing a game. At the start of the game, a number is given, along with two positive integers , which initially satisfy .
Masha moves first. On each turn, a player must increase exactly one of or by , but may not make ; otherwise that player loses.
Now Masha wants to know, if both players play optimally, for the same and different , who will win.
Input Format
The first line contains a number .
The second line contains a number , the number of test cases.
The next lines each contain two numbers , describing each test case.
Output Format
Output lines, one for each test case:
- If Masha wins, output
Masha. - If Stas wins, output
Stas. - If it is a draw, output
Missing.
9
2
2 2
1 4
Masha
Missing
Hint
Constraints
- For 30% of the testdata, .
- For 100% of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号