# Who will win the game?

There are two players $A$ and $B$.

There are two bags with $n_1$ and $n_2$ things in it.

$A$ will start the game and can take out $x$ where $1\leq x \leq \min(n_1,n_2)$ number of things from either of bags or both the bags.

A player looses the game if in his chance both the bags are empty.

Given $n_1$ and $n_2$, how to find who will win the game?

If $n\oplus_3m=0$ then $B$ will win, else it's A (assuming they plays perfectly).
$\oplus_3$ is the addition in base 3 without carry.
For example $7\oplus_35=0$ because $7_{10}=21_3$ and $5_{10}=12_3$ and $2\oplus_31=0$
You can prove that when $n\oplus_3 m\neq 0$, there is always a way to change the game such that you let a $\oplus_3$sum of $0$ to opponent, but if $n\oplus_3 m= 0$, there is no possibility to left a $\oplus_3$sum of $0$ to opponent.