#include <bits/stdc++.h>
using namespace std;
int sqr[200 + 10][200 + 10];
int dRow[4] = {0, 0, 1, -1};
int dCol[4] = {1, -1, 0, 0};
int dfs(int row, int col) {
  if (sqr[row][col] != 0) return 0;
  sqr[row][col] = 1;
  int ret = 1;
  for (int i = 0; i < 4; i++) {
    if (sqr[row + dRow[i]][col + dCol[i]] == 0)
      ret += dfs(row + dRow[i] * 2, col + dCol[i] * 2);
  }
  return ret;
}
int main(void) {
  int W, H, N;
  int sx, sy, ex, ey;
  while (cin >> W >> H >> N) {
    memset(sqr, 0, sizeof sqr);
    W += W + 1;
    H += H + 1;
    for (int i = 0; i < W; i++) sqr[0][i] = sqr[H - 1][i] = 1;
    for (int i = 0; i < H; i++) sqr[i][0] = sqr[i][W - 1] = 1;
    for (int i = 0; i < N; i++) {
      cin >> sx >> sy >> ex >> ey;
      sx *= 2;
      sy *= 2;
      ex *= 2;
      ey *= 2;
      if (sx == ex)
        for (int i = sy; i <= ey; i++) sqr[i][sx] = 1;
      if (sy == ey)
        for (int i = sx; i <= ex; i++) sqr[sy][i] = 1;
    }
    vector<int> result;
    for (int i = 1; i < H; i += 2) {
      for (int j = 1; j < W; j += 2) {
        if (sqr[i][j] == 0) result.push_back(dfs(i, j));
      }
    }
    sort(result.begin(), result.end());
    cout << result[0];
    for (int i = 1; i < result.size(); i++) cout << ' ' << result[i];
    cout << endl;
  }
}
