Solution (source code)

= Solution

A pair belongs to $R\circ R$ exactly when two successive $R$ steps connect its endpoints. The chain $a\to b\to c\to d$ has two such length-two paths, $a\to b\to c$ and $b\to c\to d$. Hence
$$
\boxed{R\circ R=\{(a,c),(b,d)\}.}
$$
This applies <composition of relations> directly; no other middle element gives a pair.