#include <bits/stdc++.h>
using namespace std;
int w, h, n, sx, sy, fx, fy, wk[300][300] = {0}, tps, sum[10010] = {0};
void dfs(int x, int y) {
  if (x < 0 || y < 0 || x > h + h || y > w + w) return;
  if (wk[x][y] == 1 || wk[x][y] == 3) return;
  if (wk[x][y] == 0) tps++;
  wk[x][y] = 3;
  dfs(x + 1, y);
  dfs(x, y + 1);
  dfs(x - 1, y);
  dfs(x, y - 1);
  return;
}
int main() {
  cin >> h >> w >> n;
  for (int i = 1; i <= n; i++) {
    cin >> sx >> sy >> fx >> fy;
    sx += sx;
    sy += sy;
    fx += fx;
    fy += fy;
    if (sx == fx) {
      for (int i = sy; i <= fy; i++) wk[sx][i] = 1;
    } else {
      for (int i = sx; i <= fx; i++) {
        wk[i][sy] = 1;
      }
    }
  }
  for (int i = 0; i <= h + h; i++) {
    if (i % 2 == 0) {
      for (int j = 0; j <= w + w; j++)
        if (wk[i][j] == 0) wk[i][j] = 2;
    } else {
      for (int j = 0; j <= w + w; j++)
        if (wk[i][j] == 0 && j % 2 == 0) wk[i][j] = 2;
    }
  }
  for (int i = 0; i <= h + h; i++) {
    for (int j = 0; j <= w + w; j++) {
      tps = 0;
      dfs(i, j);
      sum[tps]++;
    }
  }
  for (int i = 1; i <= w * h; i++)
    for (int j = 1; j <= sum[i]; j++) cout << i << " ";
  return 0;
}
