#include <bits/stdc++.h>
using namespace std;
int aa[220][220];
vector<int> v;
int dfs(int a, int b);
int w, h, n;
int main() {
  memset(aa, 0, sizeof(aa));
  cin >> w >> h >> n;
  for (int i = 0; i < (int)n; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2) {
      for (int i = 2 * y1; i <= 2 * y2; i++) {
        aa[i][2 * x1] = 2;
      }
    } else {
      for (int i = 2 * x1; i <= 2 * x2; i++) {
        aa[2 * y1][i] = 2;
      }
    }
  }
  for (int i = 0; i < (int)2 * h + 1; i++) {
    aa[i][0] = 2;
    aa[i][2 * w] = 2;
  }
  for (int i = 0; i < (int)2 * w + 1; i++) {
    aa[0][i] = 2;
    aa[2 * h][i] = 2;
  }
  for (int i = 0; i < (int)2 * h + 1; i++) {
    for (int j = 0; j < (int)2 * w + 1; j++) {
      if (aa[i][j] == 0) {
        int count = dfs(i, j);
        v.push_back(count);
      }
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < (int)v.size(); i++) cout << v[i] << " ";
  cout << endl;
  return 0;
}
int dfs(int i, int j) {
  if (i < 0 || i > 2 * h || j < 0 || j > 2 * w) return 0;
  if (aa[i][j] != 0) return 0;
  aa[i][j] = 1;
  if (i % 2 == 0 || j % 2 == 0)
    return dfs(i + 1, j) + dfs(i, j + 1) + dfs(i - 1, j) + dfs(i, j - 1);
  return 1 + dfs(i + 1, j) + dfs(i, j + 1) + dfs(i - 1, j) + dfs(i, j - 1);
}
