#include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
int n, m, k, color, col[111][111], s[111];
bool vis[111][111][2];
void dfs(int i, int j) {
  col[i][j] = color;
  if (i < 0 || j < 0)
    while (1)
      ;
  for (int d = 0; d < 4; d++) {
    int I = i + dx[d], J = j + dy[d];
    if (I < 0 || I >= n || J < 0 || J >= m) continue;
    if (col[I][J]) continue;
    if (d == 0) {
      if (!vis[I][J][1]) dfs(I, J);
    } else if (d == 1) {
      if (!vis[I][J][0]) dfs(I, J);
    } else if (d == 2) {
      if (!vis[i][j][1]) dfs(I, J);
    } else {
      if (!vis[i][j][0]) dfs(I, J);
    }
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    int stx, sty, enx, eny;
    scanf("%d %d %d %d", &stx, &sty, &enx, &eny);
    if (stx == enx) {
      for (int j = sty; j < eny; j++) vis[stx][j][0] = 1;
    } else {
      for (int j = stx; j < enx; j++) vis[j][sty][1] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (col[i][j]) continue;
      color++;
      dfs(i, j);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) s[col[i][j]]++;
  }
  sort(s + 1, s + k + 2);
  for (int i = 1; i <= k + 1; i++) printf("%d ", s[i]);
  puts("");
  return 0;
}
