Given a matrix of positive integers, output whether it's possible to generate it by starting with an empty1 matrix of the same dimensions and repeatedly filling a whole row or a whole column with the same value, overwriting any values already written.
Example
The following matrix:
$$\begin{pmatrix}1&1&1\\2&3&4\\2&3&4\end{pmatrix}$$
Can be obtained with the following steps:
$$ \begin{pmatrix}2&0&0\\2&0&0\\2&0&0\end{pmatrix}\rightarrow \begin{pmatrix}2&3&0\\2&3&0\\2&3&0\end{pmatrix}\rightarrow \begin{pmatrix}2&3&4\\2&3&4\\2&3&4\end{pmatrix}\rightarrow \begin{pmatrix}1&1&1\\2&3&4\\2&3&4\end{pmatrix} $$
Test cases
[[1,1,1,1,1],
[2,3,4,5,6],
[2,3,4,5,6]] => true
[[1,1,1,1,1],
[2,3,4,1,6],
[2,3,4,1,6]] => true
[[1,1,1,1,6],
[2,3,4,1,6],
[2,3,4,1,6]] => true
[[1,1],
[1,1]] => true
[[1,2],
[2,1]] => false
[[1,2],
[3,4]] => false
[[1,1,2],
[4,5,2],
[4,3,3]] => false
[[1,2,4],
[2,1,4],
[3,3,3]] => false
Shortest code in each languages win.
1 You can assume it is initially filled with zeros