#include <bits/stdc++.h>
using namespace std;
int w, h, num;
int x[4] = {-1, 0, 1, 0};
int y[4] = {0, 1, 0, -1};
bool visit[105][105] = {0}, g[105][105][4];
vector<int> ans;
void dfs(int n, int m) {
  if (n < 0 || n >= w || m < 0 || m >= h || visit[n][m]) return;
  visit[n][m] = 1;
  num++;
  for (int i = 0; i < 4; i++)
    if (g[n][m][i]) dfs(n + x[i], m + y[i]);
}
int main(void) {
  memset(g, true, sizeof(g));
  int n;
  cin >> w >> h >> n;
  for (int i = 0; i < n; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a == c)
      for (int i = b; i < d; i++) g[a][i][0] = g[a - 1][i][2] = 0;
    else
      for (int i = a; i < c; i++) g[i][b][3] = g[i][b - 1][1] = 0;
  }
  for (int i = 0; i < w; i++)
    for (int j = 0; j < h; j++)
      if (!visit[i][j]) {
        num = 0;
        dfs(i, j);
        ans.push_back(num);
      }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
  return 0;
}
