Solution (source code)

= Solution

The missing sets in the five columns are $\{4,5\}$, $\{1,3\}$, $\{4,5\}$, $\{2,3\}$ and $\{1,2\}$. One choice of distinct representatives is $(4,1,5,3,2)$, giving the fourth row. Each column then has exactly one missing number, producing the fifth row $(5,3,4,2,1)$. A completed square is
$$
\boxed{\begin{pmatrix}1&2&3&4&5\\2&4&1&5&3\\3&5&2&1&4\\4&1&5&3&2\\5&3&4&2&1\end{pmatrix}.}
$$
Every row and column contains each number from one to five once. The construction explicitly chooses from the missing sets, so it preserves all entries of the given rectangle.