#include <bits/stdc++.h>
using namespace std;
struct cut {
  int a, b, c, d;
  bool u;
};
int n, m, k;
vector<cut> v;
vector<int> ans;
void func(int x1, int y1, int x2, int y2) {
  bool t = 0;
  for (int i = 0; i < v.size(); i++) {
    if ((!v[i].u) &&
        ((v[i].a == x1 && v[i].c == x2 && v[i].b > y1 && v[i].b < y2) ||
         (v[i].b == y1 && v[i].d == y2 && v[i].a > x1 && v[i].a < x2))) {
      t = 1;
      v[i].u = 1;
      if (v[i].b == v[i].d) {
        func(x1, y1, x2, v[i].b);
        func(x1, v[i].b, x2, y2);
      } else {
        func(v[i].a, y1, x2, y2);
        func(x1, y1, v[i].a, y2);
      }
    }
  }
  if (!t) {
    ans.push_back((x2 - x1) * (y2 - y1));
  }
}
int main(void) {
  cin >> n >> m >> k;
  for (int i = 0; i < k; i++) {
    int a, b, c, d;
    cut _c;
    cin >> a >> b >> c >> d;
    _c.a = a;
    _c.b = b;
    _c.c = c;
    _c.d = d;
    _c.u = 0;
    v.push_back(_c);
  }
  cout << endl;
  func(0, 0, n, m);
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
  return 0;
}
