The left hand side shows a $4\times 5$ latin rectangle with entries $1,\dotsc,7$ (so $p=4$ and $q=5$ and $n=7$). We want to extend it to make a $7\times 7$ latin square. To see whether this is possible, we inspect the multiplicities $m(k)$ and excesses $e(k)=m(k)+n-p-q=m(k)-2$ for the numbers $k=1,\dotsc,7$. We have $e(k)\geq 0$ for all $k$, so the extension problem is solvable.
Next