Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

D. Chocolate

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputBob 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* = *x*_{c} or *y* = *y*_{c}, where *x*_{c} and *y*_{c} 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 *x*_{i, 1}, *y*_{i, 1}, *x*_{i, 2}, *y*_{i, 2} — coordinates of the endpoints of the *i*-th break (0 ≤ *x*_{i, 1} ≤ *x*_{i, 2} ≤ *W*, 0 ≤ *y*_{i, 1} ≤ *y*_{i, 2} ≤ *H*, or *x*_{i, 1} = *x*_{i, 2}, or *y*_{i, 1} = *y*_{i, 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.

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

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/20/2017 18:26:01 (c2).

Desktop version, switch to mobile version.

User lists

Name |
---|