Solution (source code)

= Solution

In the order $(1,2,3,L,G)$, where $L$ means left without a degree and $G$ means graduated, the <transition matrix> is
$$
\boxed{P=
\begin{pmatrix}
q&r&0&p&0\\
0&q&r&p&0\\
0&0&q&p&r\\
0&0&0&1&0\\
0&0&0&0&1
\end{pmatrix}.}
$$
Here $p+q+r=1$.