#include <bits/stdc++.h>
using namespace std;
const int MN = 100 + 10;
struct block {
  int x1, y1, x2, y2;
  static block make(int x1, int y1, int x2, int y2) {
    block nw;
    nw.x1 = x1;
    nw.y1 = y1;
    nw.x2 = x2;
    nw.y2 = y2;
    return nw;
  }
};
list<block> ls;
list<block>::iterator it;
vector<int> v;
block arr[MN];
bool used[MN];
int main() {
  int w, h, n;
  cin >> w >> h >> n;
  ls.push_back(block::make(0, 0, w, h));
  for (int i = 0; i < n; i++) {
    block nw;
    cin >> nw.x1 >> nw.y1 >> nw.x2 >> nw.y2;
    arr[i] = nw;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (used[j]) continue;
      block nw = arr[j];
      for (it = ls.begin(); it != ls.end(); it++) {
        block tmp = *it;
        if ((nw.x1 == tmp.x1 && nw.x2 == tmp.x2 && nw.y2 >= tmp.y1 &&
             nw.y2 <= tmp.y2) ||
            (nw.y1 == tmp.y1 && nw.y2 == tmp.y2 && nw.x2 >= tmp.x1 &&
             nw.x2 <= tmp.x2)) {
          ls.erase(it);
          ls.push_back(block::make(tmp.x1, tmp.y1, nw.x2, nw.y2));
          ls.push_back(block::make(nw.x1, nw.y1, tmp.x2, tmp.y2));
          used[j] = true;
          break;
        }
      }
      if (used[j]) break;
    }
  }
  for (it = ls.begin(); it != ls.end(); it++) {
    block tmp = *it;
    v.push_back((tmp.x2 - tmp.x1) * (tmp.y2 - tmp.y1));
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  return 0;
}
