Let $\mathbb{P}$ be the set of all prime numbers. Find all functions $f: \mathbb{P} \rightarrow \mathbb{P}$ such that

$$
f(p)^{f(q)} + q^p = f(q)^{f(p)} + p^q
$$

holds for all $p, q \in \mathbb{P}$.
Obviously, the identical function $f(p)=p$ for all $p \in \mathbb{P}$ is a solution. We will show that this is the only one.

First we will show that $f(2)=2$. Taking $q=2$ and $p$ any odd prime number, we have

$$
f(p)^{f(2)}+2^{p}=f(2)^{f(p)}+p^{2} .
$$

Assume that $f(2) \neq 2$. It follows that $f(2)$ is odd and so $f(p)=2$ for any odd prime number $p$.

Taking any two different odd prime numbers $p, q$ we have

$$
2^{2}+q^{p}=2^{2}+p^{q} \Rightarrow p^{q}=q^{p} \Rightarrow p=q,
$$

contradiction. Hence, $f(2)=2$.
So for any odd prime number $p$ we have

$$
f(p)^{2}+2^{p}=2^{f(p)}+p^{2} .
$$

Copy this relation as

$$
2^{p}-p^{2}=2^{f(p)}-f(p)^{2}
$$

Let $T$ be the set of all positive integers greater than 2, i.e. $T=\{3,4,5, \ldots\}$. The function $g: T \rightarrow \mathbb{Z}, g(n)=2^{n}-n^{2}$, is strictly increasing, i.e.

$$
g(n+1)-g(n)=2^{n}-2 n-1>0
$$

for all $n \in T$. We show this by induction. Indeed, for $n=3$ it is true, $2^{3}-2 \cdot 3-1>0$. Assume that $2^{k}-2 k-1>0$. It follows that for $n=k+1$ we have

$$
2^{k+1}-2(k+1)-1=\left(2^{k}-2 k-1\right)+\left(2^{k}-2\right)>0
$$

for any $k \geq 3$. Therefore, (2) is true for all $n \in T$.
As a consequence, (1) holds if and only if $f(p)=p$ for all odd prime numbers $p$, as well as for $p=2$.

Therefore, the only function that satisfies the given relation is $f(p)=p$, for all $p \in \mathbb{P}$.