Let $f$, $g$ be transcendental entire functions and $p$, $q$ be
nonlinear polynomials with deg $p \neq 3, 6$. Suppose that $f$ and
$p$ are prime and $f(p(z)) = g(q(z))$, then $f=g \circ L$ and
$p=L^{-1} \circ q$, where $L$ is a linear polynomial. Similar results
for $p(f(z)) = q(g(z))$ are also obtained.