#include <bits/stdc++.h>
using namespace std;
int n, m, t, sum, tot;
int e[105][105][4], p[105][105], s[105];
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
void dfs(int x, int y) {
  sum++;
  p[x][y] = 1;
  for (int i = 0; i < 4; ++i) {
    if (e[x][y][i] == 0) continue;
    int tx = x + dx[i];
    int ty = y + dy[i];
    if (tx > 0 && tx <= n && ty > 0 && ty <= m && p[tx][ty] == 0) {
      dfs(tx, ty);
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &t);
  memset(e, 1, sizeof(e));
  int x1, y1, x2, y2;
  for (int i = 0; i < t; ++i) {
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    if (x1 == x2) {
      for (int j = y1 + 1; j <= y2; ++j) {
        e[x1][j][1] = e[x1 + 1][j][0] = 0;
      }
    } else {
      for (int j = x1 + 1; j <= x2; ++j) {
        e[j][y1 + 1][2] = e[j][y1][3] = 0;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (p[i][j] == 0) {
        sum = 0;
        dfs(i, j);
        s[tot++] = sum;
      }
    }
  }
  sort(s, s + tot);
  for (int i = 0; i < tot; ++i) {
    printf("%d ", s[i]);
  }
  puts("");
  return 0;
}
