6043: 巧克力

内存限制:256 MB 时间限制:2 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:4 通过:3

题目描述


Bob has a rectangular chocolate bar of the size W×H. He introduced a cartesian coordinate system so that the point (0,0) corresponds to the lower-left corner of the bar, and the point (W,H) corresponds to the upper-right corner. Bob decided to split the bar into pieces by breaking it. Each break is a segment parallel to one of the coordinate axes, which connects the edges of the bar. More formally, each break goes along the line x=xc or y=yc, where xc and yc are integers. It should divide one part of the bar into two non-empty parts. After Bob breaks some part into two parts, he breaks the resulting parts separately and independently from each other. Also he doesn't move the parts of the bar. Bob made n breaks and wrote them down in his notebook in arbitrary order. At the end he got n+1 parts. Now he wants to calculate their areas. Bob is lazy, so he asks you to do this task.
Input
The first line contains 3 integers W, H and n (1≤W,H,n≤100) − width of the bar, height of the bar and amount of breaks. Each of the following n lines contains four integers xi,1,yi,1,xi,2,yi,2 − coordinates of the endpoints of the i-th break (0≤xi,1xi,2W,0≤yi,1yi,2H, or xi,1=xi,2, or yi,1=yi,2). Breaks are given in arbitrary order.
It is guaranteed that the set of breaks is correct, i.e. there is some order of the given breaks that each next break divides exactly one part of the bar into two non-empty parts.


Output
Output n+1 numbers − areas of the resulting parts in the increasing order.

给你一个W × H的巧克力。将它对应到笛卡尔坐标系下,则左下角对应点(0,0),右上角对应点(W,H)。现在将这块巧克力用n刀切割,保证每刀都平行于坐标轴。n刀过后这块巧克力被分成了几部分,请求出这几部分的面积分别是几。保证切完以后不存在只被切了一部分的巧克力。即对于任意一部分巧克力内部不存在刀口。



第一行是三个整数W,H,n。下面n行,每行四个整数为每一刀的起始坐标和终止坐标。保证这两个坐标要么x相同要么y相同。保证数据合法。



直接按照不降序输出每一块的面积



Examples
Input
2 2 2
1 0 1 2
0 1 1 1
Output
1 1 2 
Input
2 2 3
1 0 1 2
0 1 1 1
1 1 2 1
Output
1 1 1 1 
Input
2 4 2
0 1 2 1
0 3 2 3
Output
2 2 4 

输入样例 复制


输出样例 复制