This problem was in the December easy challenge.
The solution is like this:
Basically you just take xor of all (nos%5). If it is 0 player B wins else player A wins.
Can someone explain me the idea behind this solution? there wasn’t editorial for this problem, so posting this question here.