C2. We consider rectangular boards consisting of $m \times n$ squares arranged in $m$ (horizontal) rows and $n$ (vertical) columns. We want to color each square of such a board black or white in such a way that the following three conditions are met:

- In each row, there are exactly as many black squares as white squares.
- If a row and a column intersect at a black square, then that row and that column contain exactly the same number of black squares.
- If a row and a column intersect at a white square, then that row and that column contain exactly the same number of white squares.

Determine all pairs $(m, n)$ for which such a coloring of the board is possible.
C2. In the following cases, there is a coloring of the board that meets the requirements.

- $m=n$ is even

In this case, we color the board according to a checkerboard pattern. That means: in each row and column, the squares alternate between black and white. This coloring meets all the requirements.

- $n=2 m$

In this case, we can color all the squares in the left half of the board white and all the squares in the right half black. This coloring meets all the requirements.

Now we will show that these are the only possibilities. Consider a colored board that meets all the requirements. Since there are an equal number of black and white squares in each row, the number of squares in a row must be divisible by 2. Write $n=2 k$. Each row now has exactly $k$ white and exactly $k$ black squares. Now consider the leftmost column. If all the squares in the leftmost column are white, then the column has $k$ white squares due to the second requirement. We then have $m=k$. The same happens if all the squares in the leftmost column are black. If there are both white and black squares in the leftmost column, then due to the second requirement, there must be exactly $k$ white and $k$ black squares, and we find $m=2 k=n$.

We conclude that for a pair $(m, n)$, a coloring exists if and only if $n=2 m$ or if $m=n$ and $n$ is even.