The other answer is correct that this can be easily solved by Fermat’s Little Theorem. However, you also need a second lemma that went unstated so I’ll state and prove it.
Definition: Let $a,b,c\in\mathbb Z$ such that $a$ is prime. Then $a|bc\Rightarrow a|b$ or $a|c$.
Lemma: Let $p,q\in\mathbb Z$ be distinct primes. Then for all $x\in\mathbb Z$
$$p| x\land q|x\iff pq|x$$
Proof: The $\Leftarrow$ direction is trivial. For the $\Rightarrow$ direction, suppose that $x=kp=\ell q$. Since $q|kp$ and distinct primes don’t divide each other, by the definition of primality we have that $q|k$. Therefore $x=mpq\Rightarrow $pq|x$.