#include <bits/stdc++.h>
using namespace std;
struct sqq {
  int x0, y0, x2, y2;
};
int w, h, n;
int i, j, k;
bool b[10000];
vector<sqq> a;
int main() {
  cin >> w >> h >> n;
  sqq cur;
  cur.x0 = 0;
  cur.y0 = 0;
  cur.x2 = w;
  cur.y2 = h;
  a.push_back(cur);
  queue<sqq> q;
  for (i = 0; i < n; i++) {
    sqq cur;
    cin >> cur.x0 >> cur.y0 >> cur.x2 >> cur.y2;
    q.push(cur);
  }
  while (!q.empty()) {
    sqq cur;
    int xx1, xx2, yy1, yy2;
    bool flag = false;
    cur = q.front();
    q.pop();
    xx1 = cur.x0;
    xx2 = cur.x2;
    yy1 = cur.y0;
    yy2 = cur.y2;
    for (j = 0; j < a.size(); j++)
      if (!b[j]) {
        if (xx1 == xx2) {
          if (xx1 > a[j].x0 && xx1 < a[j].x2 && yy1 == a[j].y0 &&
              yy2 == a[j].y2) {
            b[j] = true;
            sqq cur1;
            cur1.x0 = a[j].x0;
            cur1.y0 = a[j].y0;
            cur1.x2 = xx2;
            cur1.y2 = yy2;
            a.push_back(cur1);
            cur1.x0 = xx1;
            cur1.y0 = yy1;
            cur1.x2 = a[j].x2;
            cur1.y2 = a[j].y2;
            a.push_back(cur1);
            flag = true;
          }
        }
        if (yy1 == yy2) {
          if (yy1 > a[j].y0 && yy1 < a[j].y2 && xx1 == a[j].x0 &&
              xx2 == a[j].x2) {
            b[j] = true;
            sqq cur1;
            cur1.x0 = a[j].x0;
            cur1.y0 = a[j].y0;
            cur1.x2 = xx2;
            cur1.y2 = yy2;
            a.push_back(cur1);
            cur1.x0 = xx1;
            cur1.y0 = yy1;
            cur1.x2 = a[j].x2;
            cur1.y2 = a[j].y2;
            a.push_back(cur1);
            flag = true;
          }
        }
        if (flag) break;
      }
    if (!flag) q.push(cur);
  }
  vector<int> res;
  for (i = 0; i < a.size(); i++)
    if (!b[i]) {
      res.push_back((a[i].y2 - a[i].y0) * (a[i].x2 - a[i].x0));
    }
  sort(res.begin(), res.end());
  for (i = 0; i < res.size(); i++) cout << res[i] << " ";
  return 0;
}
