#include <bits/stdc++.h>
using namespace std;
int a, b, n, tot = 0, ans[50005], tmp = 0;
int x[105], y[105], xx[105], yy[105], v[205][205];
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
void dfs(int posx, int posy) {
  if (v[posx][posy] == 0) tmp++;
  v[posx][posy] = 1;
  for (int i = 0; i < 4; i++) {
    int nowx = posx + dx[i], nowy = posy + dy[i];
    if (nowx >= 0 && nowx <= 2 * a && nowy >= 0 && nowy <= 2 * b) {
      if (v[nowx][nowy] != 1) {
        dfs(nowx, nowy);
      }
    }
  }
}
int main() {
  cin >> a >> b >> n;
  for (int i = 1; i <= n; i++) cin >> x[i] >> y[i] >> xx[i] >> yy[i];
  for (int i = 1; i <= n; i++) x[i] *= 2, y[i] *= 2, xx[i] *= 2, yy[i] *= 2;
  for (int i = 0; i <= 2 * a; i++)
    for (int j = 0; j <= 2 * b; j++) v[i][j] = 2;
  for (int i = 1; i <= a; i++)
    for (int j = 1; j <= b; j++) v[i * 2 - 1][j * 2 - 1] = 0;
  for (int i = 1; i <= n; i++) {
    if (x[i] == xx[i]) {
      for (int j = y[i]; j <= yy[i]; j++) v[x[i]][j] = 1;
    }
    if (y[i] == yy[i]) {
      for (int j = x[i]; j <= xx[i]; j++) v[j][y[i]] = 1;
    }
  }
  for (int i = 0; i <= 2 * a; i++) {
    for (int j = 0; j <= 2 * b; j++) {
      if (v[i][j] != 1) {
        tmp = 0;
        tot++;
        dfs(i, j);
        ans[tot] = tmp;
      }
    }
  }
  sort(ans + 1, ans + tot + 1);
  for (int i = 1; i <= tot; i++) cout << ans[i] << " ";
  return 0;
}
