Find all pairs of prime numbers $(p, q)$ such that $p \mid 5^{q}+1$ and $q \mid 5^{p}+1$.
We are given a solution $(p, q)$ and assume $q \leqslant p$ without loss of generality. Then $5^{p} \equiv -1 \pmod{q}$, so $5^{2p} \equiv 1 \pmod{q}$: the order $\omega$ of 5 modulo $q$ therefore divides $2p$.

- If $\omega=1$, then $q=2$, so $p \mid 5^{2}+1=26: p \in\{2 ; 13\}$.
- If $\omega=2$, then $q \mid 5^{2}-1$ but not $5-1$ so $q=3$, then $p \mid 126$ so $p \in\{3 ; 7\}$.
- If $\omega=p$ or $\omega=2p$, by Fermat's little theorem, $p \mid q-1$ (or even $2p \mid q-1$) so $p \leqslant q-1 < q$, which is absurd.

We easily verify that all these solutions are valid, as well as their permutations.