#include <bits/stdc++.h>
using namespace std;
int w, h, n, ans[10010];
bool x[101][101][101], y[101][101][101];
void dfs(int px, int py, int qx, int qy) {
  for (int i = px + 1; i <= qx - 1; i++)
    if (x[py][qy][i]) {
      dfs(px, py, i, qy);
      dfs(i, py, qx, qy);
      return;
    }
  for (int i = py + 1; i <= qy - 1; i++)
    if (y[px][qx][i]) {
      dfs(px, py, qx, i);
      dfs(px, i, qx, qy);
      return;
    }
  ans[++*ans] = (qx - px) * (qy - py);
}
int main() {
  scanf("%d%d%d", &w, &h, &n);
  for (int i = 1; i <= n; i++) {
    int px, py, qx, qy;
    scanf("%d%d%d%d", &px, &py, &qx, &qy);
    if (px == qx) x[py][qy][px] = 1;
    if (py == qy) y[px][qx][py] = 1;
  }
  dfs(0, 0, w, h);
  sort(ans + 1, ans + *ans + 1);
  for (int i = 1; i <= *ans; i++) printf("%d ", ans[i]);
}
