#P5635. 【CSGRound1】天下第一
【CSGRound1】天下第一
Description
The game works as follows:
Given two numbers , , and a modulus .
cbw has the number , and zhouwc has the number .
Round 1: .
Round 2: .
Round 3: .
Round 4: .
And so on...
If reaches first, then cbw wins. If reaches first, then zhouwc wins. If neither nor can reach , then it is a draw.
To protect his dignity as chairman, cbw wants to know the result of the game in advance, and he can also take the chance to “do something” behind the scenes. Therefore, he hopes you can tell him the result.
Input Format
There are multiple test cases.
The first line contains and , meaning there are test cases in total, and the modulus for all of them is .
The next lines each contain two numbers .
Output Format
Output lines in total.
means cbw wins, means zhouwc wins, and error means a draw.
1 10
1 3
error
1 10
4 5
1
Hint
.
.
Translated by ChatGPT 5
京公网安备 11011102002149号