#include <bits/stdc++.h>
using namespace std;
int n, a, b, cnt;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
bool flag[105][105][5], ok[105][105];
void check(int x, int y) {
  if (x < 0 || x >= a || y < 0 || y >= b || ok[x][y]) return;
  ok[x][y] = true;
  cnt++;
  for (int i = 0; i < 4; i++) {
    if (!flag[x][y][i]) check(x + dx[i], y + dy[i]);
  }
}
int main() {
  int x1, y1, x2, y2;
  cin >> a >> b >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2) {
      for (int j = y1; j < y2; j++) flag[x1 - 1][j][0] = flag[x1][j][1] = true;
    }
    if (y1 == y2) {
      for (int j = x1; j < x2; j++) flag[j][y1 - 1][2] = flag[j][y1][3] = true;
    }
  }
  vector<int> v;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      if (!ok[i][j]) {
        cnt = 0;
        check(i, j);
        v.push_back(cnt);
      }
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n + 1; i++) cout << v[i] << " ";
  return 0;
}
