Prove that a semigroup $S$ in which $x^3=x$ and $x^2y^2=y^2x^2$ for every $x,y \in S$ is commutative.
My attempt: From $x^3=x$, I can deduct that $x^n=x$ if $n$ is odd and $x^n=x^2$ if $n$ is even for every positive integer $n$. The problem that I can't solve is the fact that no matter what I do, I can't get rid of that $2$ that is present in the exponents of the second equation. I have also tried a lot of other combinations such as taking $x=ab$ and $y=ba$ in the second equation, but nothing seems to work. I don't see a point in writing here all of my attempts of this kind because it would take a lot of time, but if you ask m for them, I will try to write some of them. I also don't have that much experience working with semigroups. I solved dozens of problems regarding monoids, groups, rings and fields, but this is within the first problems that involves semigroups.
The semigroup's definition is very weak, and I can't even imagine how a solution to this problem would look like. Every time I plug something instead of $x$ and $y$ the problem only seems to get more and more complicated.