#include <bits/stdc++.h>
using namespace std;
int X, Y, cnt;
int dx[5] = {1, -1, 0, 0}, dy[5] = {0, 0, 1, -1};
bool edge[110][110][4];
bool used[110][110];
void dfs(int x, int y) {
  int i;
  if (x < 0 or x >= X or y < 0 or y >= Y or used[x][y]) {
    return;
  }
  used[x][y] = true;
  cnt++;
  for (int i = 0; i < 4; i++) {
    if (!edge[x][y][i]) {
      dfs(x + dx[i], y + dy[i]);
    }
  }
}
int main() {
  int N, x1, y1, x2, y2;
  cin >> X >> Y >> N;
  for (int i = 0; i < N; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2) {
      for (int j = y1; j < y2; j++) {
        edge[x1 - 1][j][0] = edge[x1][j][1] = true;
      }
    }
    if (y1 == y2) {
      for (int j = x1; j < x2; j++) {
        edge[j][y1 - 1][2] = edge[j][y1][3] = true;
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i < X; i++) {
    for (int j = 0; j < Y; j++) {
      if (!used[i][j]) {
        cnt = 0;
        dfs(i, j);
        ans.push_back(cnt);
      }
    }
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i <= N; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
