#include <bits/stdc++.h>
using namespace std;
int w, h, n;
int g[110][110][4], u[110][110], dx[]{1, -1, 0, 0}, dy[]{0, 0, 1, -1};
void dfs(int x, int y, int& cnt) {
  if (x < 0 || x >= w || y < 0 || y >= h || u[x][y] == 1) return;
  u[x][y] = 1;
  cnt++;
  for (int i = 0; i < 4; i++) {
    if (g[x][y][i] == 0) {
      dfs(x + dx[i], y + dy[i], cnt);
    }
  }
}
int main() {
  cin >> w >> h >> n;
  for (int i = 0; i < n; i++) {
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    if (a == x) {
      for (int j = b; j < y; j++) g[a - 1][j][0] = g[a][j][1] = 1;
    } else {
      for (int j = a; j < x; j++) g[j][b - 1][2] = g[j][b][3] = 1;
    }
  }
  vector<int> ans;
  for (int x = 0; x < w; x++) {
    for (int y = 0; y < h; y++) {
      if (u[x][y] == 0) {
        int cnt = 0;
        dfs(x, y, cnt);
        ans.push_back(cnt);
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans[0];
  for (int i = 1; i < ans.size(); i++) cout << ' ' << ans[i];
  cout << endl;
}
