Question from an old test:
Find an example of a periodic Markov chain with $3$ states, with a stationary distribution $( \frac{1}{6}, \frac{1}{3}, \frac{1}{2})$.
I can see only two ways to connect the states.

A triangle won't work because if we connect it in the way shown in (A), the stationary distribution is different.
If we add at least one edge going in the opposite direction, as in (B), then the chain won't be periodic, because there are periods of $3$ and $5$, so the GCD is $1$.
The second way is to connect as shown in the drawing (C) which is periodic with period $2$, but then I don't see how to choose the probabilities $p$ and $q$, because the condition for the stationary distribution to be equal to $( \frac{1}{6}, \frac{1}{3}, \frac{1}{2})$ will never be met:
$$ \begin{bmatrix} 0 & 1 & 0 \\ p & 0 & q \\ 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} \frac{1}{6} \\ \frac{1}{3} \\ \frac{1}{2} \end{bmatrix} = \begin{bmatrix} \frac{1}{6} \\ \frac{1}{3} \\ \frac{1}{2} \end{bmatrix} $$
The above is always false.
What am I missing? How to find an example of such a chain?
You multiplied with the stationary distribution on the wrong side. Markov chain transition matrices are usually written such that the distribution needs to be multiplied from the left, and indeed you wrote the matrix that way. So you want
$$ \begin{bmatrix}\frac16,\frac12,\frac13\end{bmatrix} \begin{bmatrix}0&1&0\\p&0&q\\0&1&0\end{bmatrix} = \begin{bmatrix}\frac16,\frac12,\frac13\end{bmatrix}\;, $$
and this indeed has a solution with $p=\frac13$, $q=\frac23$.