#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
int h, w, n;
int vis[110][110], edge[110][110][4];
int a[11000];
int cnt;
void dfs(int x, int y) {
  int i;
  if (x < 0 || x >= w) return;
  if (y < 0 || y >= h) return;
  if (vis[x][y]) return;
  cnt++;
  vis[x][y]++;
  for (i = 0; i < 4; ++i)
    if (!edge[x][y][i]) dfs(x + dx[i], y + dy[i]);
}
int main() {
  int i, j, x1, y1, x2, y2;
  scanf("%d%d%d", &w, &h, &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    if (x1 == x2)
      for (j = y1; j < y2; ++j) edge[x1 - 1][j][0] = edge[x1][j][1] = true;
    if (y1 == y2)
      for (j = x1; j < x2; ++j) edge[j][y1 - 1][2] = edge[j][y2][3] = true;
  }
  int m = 0;
  for (i = 0; i < w; ++i)
    for (j = 0; j < h; ++j)
      if (!vis[i][j]) {
        cnt = 0;
        dfs(i, j);
        a[++m] = cnt;
      }
  sort(a + 1, a + 1 + m);
  for (i = 1; i <= m; ++i) printf("%d ", a[i]);
  printf("\n");
  return 0;
}
