#include <bits/stdc++.h>
using namespace std;
bool used[101];
vector<int> ans;
struct Cut {
  int x1, y1, x2, y2;
  bool in(int x3, int y3, int x4, int y4) {
    if (x1 == x2)
      return x3 <= x1 && x1 <= x4 && y1 == y3 && y2 == y4;
    else
      return y3 <= y1 && y1 <= y4 && x1 == x3 && x2 == x4;
  }
  void scan() { cin >> x1 >> y1 >> x2 >> y2; }
} cut[101];
void dfs(int x1, int y1, int x2, int y2, int n) {
  for (int i = (int)0; i < (int)n; i++) {
    if (used[i]) continue;
    if (cut[i].in(x1, y1, x2, y2)) {
      used[i] = true;
      if (cut[i].x1 == cut[i].x2) {
        dfs(x1, y1, cut[i].x1, y2, n);
        dfs(cut[i].x1, y1, x2, y2, n);
      } else {
        dfs(x1, y1, x2, cut[i].y2, n);
        dfs(x1, cut[i].y1, x2, y2, n);
      }
      return;
    }
  }
  ans.push_back((x2 - x1) * (y2 - y1));
}
int main() {
  int w, h, nn;
  cin >> w >> h >> nn;
  for (int i = (int)0; i < (int)nn; i++) cut[i].scan();
  dfs(0, 0, w, h, nn);
  sort(ans.begin(), ans.end());
  for (int i = (int)0; i < (int)nn + 1; i++) {
    cout << ans[i];
    if (i == nn)
      cout << endl;
    else
      cout << " ";
  }
  return 0;
}
