#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
const int MOD = 1e9 + 7;
const int N = 107;
bool l[N][N], r[N][N], u[N][N], d[N][N];
int w, h, n;
inline int idx(int i, int j) { return i * 110 + j; }
int fa[20000];
void init() {
  for (int i = int(0); i <= int(19999); ++i) fa[i] = i;
}
int findx(int x) {
  if (x == fa[x]) return x;
  return fa[x] = findx(fa[x]);
}
inline void unite(int x, int y) { fa[findx(x)] = findx(y); }
int sz[20000];
int main() {
  init();
  scanf("%d%d%d", &w, &h, &n);
  memset(l, 1, sizeof(l));
  memset(r, 1, sizeof(r));
  memset(u, 1, sizeof(u));
  memset(d, 1, sizeof(d));
  for (int i = int(1); i <= int(n); ++i) {
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    if (x1 == x2) {
      for (int j = int(y1 + 1); j <= int(y2); ++j) {
        r[x1][j] = 0;
        l[x1 + 1][j] = 0;
      }
    } else {
      for (int j = int(x1 + 1); j <= int(x2); ++j) {
        u[j][y1] = 0;
        d[j][y1 + 1] = 0;
      }
    }
  }
  for (int i = int(1); i <= int(w); ++i)
    for (int j = int(1); j <= int(h); ++j) {
      if (i != 1) {
        if (l[i][j]) {
          unite(idx(i - 1, j), idx(i, j));
        }
      }
      if (j != 1) {
        if (d[i][j]) {
          unite(idx(i, j - 1), idx(i, j));
        }
      }
      if (i != w) {
        if (r[i][j]) {
          unite(idx(i + 1, j), idx(i, j));
        }
      }
      if (j != h) {
        if (u[i][j]) {
          unite(idx(i, j + 1), idx(i, j));
        }
      }
    }
  vector<int> ans;
  for (int i = int(1); i <= int(w); ++i)
    for (int j = int(1); j <= int(h); ++j) sz[findx(idx(i, j))]++;
  for (int i = int(1); i <= int(w); ++i)
    for (int j = int(1); j <= int(h); ++j) {
      int c = idx(i, j);
      if (c == findx(c)) ans.push_back(sz[c]);
    }
  sort(ans.begin(), ans.end());
  printf("%d", ans[0]);
  for (int i = 1, len = ans.size(); i < len; ++i) printf(" %d", ans[i]);
  puts("");
  return 0;
}
