#include <bits/stdc++.h>
using namespace std;
int was[110];
pair<pair<int, int>, pair<int, int> > fissure[110];
int areas[110];
int main() {
  int W, H, n;
  cin >> W >> H >> n;
  for (int i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (make_pair(x1, y1) > make_pair(x2, y2)) {
      swap(x1, x2);
      swap(y1, y2);
    }
    fissure[i] = make_pair(make_pair(x1, y1), make_pair(x2, y2));
  }
  set<pair<pair<int, int>, pair<int, int> > > rects;
  rects.insert(make_pair(make_pair(0, 0), make_pair(W, H)));
  int cnt = 0;
  while (cnt < n) {
    for (int i = 0; i < n; i++) {
      if (was[i]) continue;
      bool isValid = false;
      for (pair<pair<int, int>, pair<int, int> > rect : rects) {
        if (fissure[i].first.first == fissure[i].second.first) {
          if (rect.first.second == fissure[i].first.second and
              rect.second.second == fissure[i].second.second and
              rect.first.first < fissure[i].first.first and
              fissure[i].first.first < rect.second.first) {
            isValid = true;
            rects.erase(rect);
            rects.insert(make_pair(rect.first, fissure[i].second));
            rects.insert(make_pair(fissure[i].first, rect.second));
            break;
          }
        } else if (fissure[i].first.second == fissure[i].second.second) {
          if (rect.first.first == fissure[i].first.first and
              rect.second.first == fissure[i].second.first and
              rect.first.second < fissure[i].first.second and
              fissure[i].first.second < rect.second.second) {
            isValid = true;
            rects.erase(rect);
            rects.insert(make_pair(rect.first, fissure[i].second));
            rects.insert(make_pair(fissure[i].first, rect.second));
            break;
          }
        }
      }
      if (isValid) {
        was[i] = true;
        cnt++;
        break;
      }
    }
  }
  int i = 0;
  for (pair<pair<int, int>, pair<int, int> > rect : rects) {
    areas[i++] = (rect.second.first - rect.first.first) *
                 (rect.second.second - rect.first.second);
  }
  sort(areas, areas + n + 1);
  for (int i = 0; i < n + 1; i++) cout << areas[i] << " ";
  return 0;
}
