Solution (source code)

= Solution

When all three points are finite, use
$$
\boxed{g(z)=\frac{(z-z_1)(z_2-z_3)}{(z-z_3)(z_2-z_1)}.}
$$
The distinctness assumptions ensure that it is a nonconstant <Möbius transformation>, and direct substitution gives the three required values. If one of the specified points is infinity, the limiting formulas are
$$
\begin{array}{c|c}
z_3=\infty&(z-z_1)/(z_2-z_1)\\
z_1=\infty&(z_2-z_3)/(z-z_3)\\
z_2=\infty&(z-z_1)/(z-z_3).
\end{array}
$$
These cover every case because the points are distinct.

For uniqueness, if $g$ and $\widetilde g$ have the same three images, the Möbius map $\widetilde g\circ g^{-1}$ fixes $0,1,\infty$. Fixing zero and infinity makes it $z\mapsto cz$ with $c\ne0$; fixing one gives $c=1$. Therefore \b[the normalized map is unique]. This is the <sharp three-transitivity of Möbius transformations>.