I want to find a solution $x \in \mathbb{N}$ of $x^{125} \equiv 7 \ (\mathrm{mod} \ 39)$ by using Ender Wiggin's method Find $x^{98}$ congruent to $7$ (mod $18$)
My steps are:
$x^{125} \equiv 7 \ (\mathrm{mod} \ 39) \Rightarrow x^{125}=7+39 \cdot n,\ n \in \mathbb{N}$
$\Rightarrow \mathrm{gcd}(x,39)=1$
It's $\varphi(39)=\varphi(3)\cdot\varphi(13)=24$
So $x^{24} \equiv 1 \ (\mathrm{mod} \ 39)$
Since $x^{125} \equiv 7 \ (\mathrm{mod} \ 3)$ and $x^{125} \equiv 7 \ (\mathrm{mod} \ 13)$ it follows that
$x^{\varphi(3)}=x^2 \equiv 1 \ (\mathrm{mod} \ 3)$ and $x^{\varphi(13)}=x^{12} \equiv 1 \ (\mathrm{mod} \ 13)$.
Now I don't know what to do next.
I tried with $x=4$ and it works, but how to show it properly?
What has to be done now?