#include <bits/stdc++.h>
using namespace std;
struct rect {
  int x1, y1, x2, y2;
};
struct rect a[40001], c[40001];
int b[40001];
int w, h, n, nr;
void enter() {
  scanf("%d%d%d", &w, &h, &n);
  nr = 1;
  a[1].x1 = 0;
  a[1].y1 = 0;
  a[1].x2 = w;
  a[1].y2 = h;
}
void call1(int x1, int y1, int x2, int y2) {
  int i;
  for (i = 1; i <= nr; i++)
    if ((a[i].x1 < x1) && (x2 < a[i].x2) && (a[i].y1 == y1) && (a[i].y2 == y2))
      break;
  nr++;
  a[nr] = a[i];
  a[i].x2 = x2;
  a[nr].x1 = x2;
}
void call2(int x1, int y1, int x2, int y2) {
  int i;
  for (i = 1; i <= nr; i++)
    if ((a[i].y1 < y1) && (y2 < a[i].y2) && (a[i].x1 == x1) && (a[i].x2 == x2))
      break;
  nr++;
  a[nr] = a[i];
  a[i].y2 = y2;
  a[nr].y1 = y2;
}
void solve() {
  int x1, y1, x2, y2, t;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    c[i].x1 = x1;
    c[i].x2 = x2;
    c[i].y1 = y1;
    c[i].y2 = y2;
    b[i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    t = 0;
    for (int j = 1; j <= n; j++)
      if ((b[j] == 1) && (t == 0)) {
        x1 = c[j].x1;
        x2 = c[j].x2;
        y1 = c[j].y1;
        y2 = c[j].y2;
        for (int k = 1; k <= nr; k++)
          if (((y1 == y2) && (a[k].y1 < y1) && (y2 < a[k].y2) &&
               (a[k].x1 == x1) && (a[k].x2 == x2)) ||
              ((x1 == x2) && (a[k].x1 < x1) && (x2 < a[k].x2) &&
               (a[k].y1 == y1) && (a[k].y2 == y2)))
            t = j;
      }
    b[t] = 0;
    x1 = c[t].x1;
    x2 = c[t].x2;
    y1 = c[t].y1;
    y2 = c[t].y2;
    if (x1 == x2)
      call1(x1, y1, x2, y2);
    else
      call2(x1, y1, x2, y2);
  }
  for (int i = 1; i <= w * h; i++) b[i] = 0;
  for (int i = 1; i <= nr; i++) b[(a[i].x2 - a[i].x1) * (a[i].y2 - a[i].y1)]++;
}
void print() {
  for (int i = 1; i <= w * h; i++)
    for (int j = 1; j <= b[i]; j++) printf("%d ", i);
}
int main() {
  enter();
  solve();
  print();
  return (0);
}
