Let $R$ be a ring, possibly noncommutative, in which $xy=0$ implies $x=0$ or $y=0$. If $a, b \in R$ and $a^n=b^n$ and $a^m=b^m$ for two relatively prime positive integers $m$ and $n$, prove that $a=b$
I guess I know the commutative case, but no idea for the noncmmutative case.
My attempt:
$gcd(m,n) = 1$, so there exist integers $x,y$ s.t. $mx+ny=1$
so $$ \begin{aligned} a^{mx+ny}=a \\ (a^m)^x \cdot(b^n)^y=a \end{aligned} $$ similarly, $$ \begin{aligned} b^{mx+ny}=b \\ (a^m)^x \cdot(b^n)^y=b \end{aligned} $$
then I get $a=b$
I know this is certainly wrong as I didn't use any property of ring or assumptions in the questions. Any hints?