#include <bits/stdc++.h>
using namespace std;
using namespace std;
struct stu {
  int x, y, xx, yy;
} w, v;
int x[105], y[105], xx[105], yy[105];
int main() {
  queue<stu> q[2];
  int ax, ay, n, i, r = 0, r1;
  scanf("%d %d %d", &ax, &ay, &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d %d", &x[i], &y[i], &xx[i], &yy[i]);
  }
  w.x = 0;
  w.y = 0;
  w.xx = ax;
  w.yy = ay;
  q[0].push(w);
  bool flag[105] = {0}, si = 0;
  ;
  while (1) {
    si = 0;
    for (i = 0; i < n; i++) {
      if (flag[i]) continue;
      si = 1;
      r1 = (r + 1) % 2;
      while (!q[r].empty()) {
        w = q[r].front();
        q[r].pop();
        if (x[i] == xx[i]) {
          if (x[i] > w.x && x[i] < w.xx && y[i] == w.y && yy[i] == w.yy) {
            v.x = w.x;
            v.y = w.y;
            v.xx = x[i];
            v.yy = w.yy;
            q[r1].push(v);
            v.xx = w.xx;
            v.yy = w.yy;
            v.x = x[i];
            v.y = w.y;
            q[r1].push(v);
            while (!q[r].empty()) {
              w = q[r].front();
              q[r].pop();
              q[r1].push(w);
            }
            flag[i] = 1;
            break;
          }
        }
        if (y[i] == yy[i]) {
          if (y[i] > w.y && y[i] < w.yy && x[i] == w.x && xx[i] == w.xx) {
            v.x = w.x;
            v.y = w.y;
            v.xx = w.xx;
            v.yy = y[i];
            q[r1].push(v);
            v.xx = w.xx;
            v.yy = w.yy;
            v.x = w.x;
            v.y = y[i];
            q[r1].push(v);
            while (!q[r].empty()) {
              w = q[r].front();
              q[r].pop();
              q[r1].push(w);
            }
            flag[i] = 1;
            break;
          }
        }
        q[r1].push(w);
      }
      r = r1;
    }
    if (si == 0) break;
  }
  int aaa[205], ww = 0;
  while (!q[r].empty()) {
    w = q[r].front();
    q[r].pop();
    aaa[ww] = (w.xx - w.x) * (w.yy - w.y);
    ww++;
  }
  sort(aaa, aaa + ww);
  for (i = 0; i < ww; i++) {
    printf("%d ", aaa[i]);
  }
  return 0;
}
