"Pieces of Paper"
Edgy the Rabbit’s got a sheet of checked paper. The grid is aligned with the edges of the sheet. In particular, all four vertices of the sheet contain grid nodes in them. Edgy cuts the sheet along the grid with his scissors. Each cut is a straight line joining two grid nodes while parallel to the grid. Determine how many connected pieces of paper Edgy will have after each cut.
Input
The first line of the input contains three positive integers: width of the sheet w (in grid units), height of the sheet h(in grid units) and the number of cuts n (w ≤ 200, h ≤ 200, n ≤ 2wh – w – h). Each of the following n lines consists of four integers x_1, y_1, x_2, y_2 where (x_1, y_1) and (x_2, y_2) are the endpoints of the cut. Here 0 ≤ x_1 ≤ x_2 ≤ w, 0 ≤ y_1 ≤ y_2 ≤ h and either 0 < x_1 = x_2 < w, y_1 < y_2 or 0 < y_1 = y_2 < h, x_1 < x_2. No segment of the grid with non-zero length will be cut through more than once.
Output
For each cut output the number of connected pieces of paper after that cut. Each number’s to be put in a separate line.