#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 5;
const long long INF = 2000000000000000000;
const double EPS = 1e-6;
int q[MAXN][4];
int a[MAXN][MAXN];
int d[100000];
int p = 0;
int cnt = 0;
void color(int x1, int y1, int x2, int y2) {
  p++;
  for (int x = x1; x < x2; x++) {
    for (int y = y1; y < y2; y++) {
      a[x][y] = p;
    }
  }
}
void calc(int x1, int y1, int x2, int y2) {
  for (int i = 0; i < cnt; i++) {
    if (q[i][0] == q[i][2]) {
      if (x1 < q[i][0] && q[i][0] < x2 && q[i][1] == y1 && q[i][3] == y2) {
        color(x1, y1, q[i][0], q[i][3]);
        color(q[i][0], q[i][1], x2, y2);
        calc(x1, y1, q[i][0], q[i][3]);
        calc(q[i][0], q[i][1], x2, y2);
        return;
      }
    } else {
      if (y1 < q[i][1] && q[i][1] < y2 && q[i][0] == x1 && q[i][2] == x2) {
        color(x1, y1, q[i][2], q[i][1]);
        color(q[i][0], q[i][1], x2, y2);
        calc(x1, y1, q[i][2], q[i][1]);
        calc(q[i][0], q[i][1], x2, y2);
        return;
      }
    }
  }
}
int main() {
  int n, w, h;
  scanf("%d%d%d", &w, &h, &n);
  while (scanf("%d%d%d%d", &q[cnt][0], &q[cnt][1], &q[cnt][2], &q[cnt][3]) ==
         4) {
    cnt++;
  }
  calc(0, 0, w, h);
  for (int i = 0; i < w; i++) {
    for (int j = 0; j < h; j++) {
      d[a[i][j]]++;
    }
  }
  vector<int> res;
  for (int i = 0; i <= p; i++) {
    if (d[i]) {
      res.push_back(d[i]);
    }
  }
  int sz = res.size();
  sort(res.begin(), res.end());
  for (int i = 0; i < sz; i++) {
    printf("%d ", res[i]);
  }
  return 0;
}
