You can check if the chessboard is consistent by checking if all the black cells have same parity and all the white cells have different parity.
Let's a cell's position is (x, y), then let's define it's parity as (x+y)%2. You can easily see that, by our definition, every adjacent pair of cells will have different parity.
So the complexity for a test case is: O(Q)