#include <bits/stdc++.h>
using namespace std;
int r[105][105], d[105][105], vis[105][105];
int w, h, n;
int bfs(int x, int y) {
  queue<pair<int, int> > q;
  q.push({x, y});
  vis[x][y] = 1;
  int area = 0;
  while (!q.empty()) {
    int cx = q.front().first, cy = q.front().second;
    q.pop();
    ++area;
    if (!d[cx][cy] && cx > 1 && !vis[cx - 1][cy])
      q.push({cx - 1, cy}), vis[cx - 1][cy] = 1;
    if (!r[cx][cy] && cy < w && !vis[cx][cy + 1])
      q.push({cx, cy + 1}), vis[cx][cy + 1] = 1;
  }
  return area;
}
int main() {
  cin >> w >> h >> n;
  int x1, x2, y1, y2;
  for (int i = 1; i <= n; ++i) {
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2)
      for (int j = y1 + 1; j <= y2; ++j) r[j][x1] = 1;
    else
      for (int j = x1 + 1; j <= x2; ++j) d[y1 + 1][j] = 1;
  }
  vector<int> ans;
  for (int i = h; i >= 1; --i)
    for (int j = 1; j <= w; ++j)
      if (!vis[i][j]) ans.push_back(bfs(i, j));
  sort(ans.begin(), ans.end());
  for (auto& x : ans) cout << x << " ";
  return 0;
}
