#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
bool walls[110][110][4], used[110][110];
int X, Y, n, cnt, plus1[4] = {1, -1, 0, 0}, plus2[4] = {0, 0, 1, -1};
void dfs(int x, int y) {
  if (x < 0 || x >= X || y < 0 || y >= Y || used[x][y]) return;
  used[x][y] = true;
  cnt++;
  for (int i = 0; i < 4; i++)
    if (!walls[x][y][i]) dfs(x + plus1[i], y + plus2[i]);
}
int main() {
  cin >> X >> Y >> n;
  for (int i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2)
      for (int j = y1; j < y2; j++)
        walls[x1 - 1][j][0] = walls[x1][j][1] = true;
    if (y1 == y2)
      for (int j = x1; j < x2; j++)
        walls[j][y1 - 1][2] = walls[j][y1][3] = true;
  }
  int ans[200], p = -1;
  for (int i = 0; i < X; i++)
    for (int j = 0; j < Y; j++) {
      if (!used[i][j]) {
        p++;
        cnt = 0;
        dfs(i, j);
        ans[p] = cnt;
      }
    }
  sort(ans, ans + n + 1);
  for (int i = 0; i < n + 1; i++) cout << ans[i] << " ";
  return 0;
}
