Rook Attack
You have been given a rows-by-cols chessboard, with a list of squares cut out. The list of cutouts will be given. This problem will involve placing rooks on a chessboard, so that they cannot attack each other. For a rook to attack a target piece, it must share the same row or column as the target. Rooks cannot be placed on cut out squares. The cut out squares do not affect where the rooks can attack.
Input
Consists of multiple test cases. The first line of each test case contains three integers: the dimensions of the chessboard and and the number of cut out squares . Next line gives the list of coordinates of cut out squares, delimited with a space. The list has a form . It is known that .
Output
For each test case print in a separate line the maximum number of rooks that can be placed on the chessboard, such that no pair of rooks can attack each other.