A meadow is an A×B rectangle. From point (X,Y), build a horizontal or vertical fence until it hits another fence. After each fence, print the areas of the two new fields, smaller first.
Input
A, B, N, then N lines with X, Y, D (1 horizontal, 2 vertical).