Question 157
On a switchboard there are $nm$ lamps arranged in an $n \times m$ array. In the beginning all lamps are off. At each step one can switch three consecutive lamps in one row or in one column, changing the state of each lamp to the opposite. For which pairs of positive integers $(n, m)$ is it possible to achieve the situation, where all the lamps are switched on?