Chess
Petryk and Vasylko are playing a game on a chessboard with dimensions n×m. Vasylko starts by placing bishops on the board in any configuration. Petryk's task is to place rooks on the remaining empty squares, ensuring that no two rooks can attack each other and that no rook is attacked by a bishop.
Your goal is to help Petryk place the maximum number of rooks possible.
Input
The first line contains two integers n and m (1 ≤ n, m ≤ 100), representing the number of rows and columns of the chessboard. The second line contains an integer k (0 ≤ k ≤ n·m), indicating the number of bishops on the board. The next k lines each contain two integers, specifying the row and column positions of each bishop.
Output
On the first line, output the maximum number of rooks that Petryk can place. On the subsequent lines, provide the positions of these rooks in the same format as the input.