#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct Point {
  T x, y;
  Point() {}
  Point(T xx, T yy) : x(xx), y(yy) {}
  bool operator==(const Point<T> &p2) { return x == p2.x && y == p2.y; }
  bool operator!=(const Point<T> &p2) { return x != p2.x || y != p2.y; }
  bool operator<(const Point<T> &p2) {
    return x < p2.x || x == p2.x && y < p2.y;
  }
  Point<T> operator+(const Point<T> &p2) {
    return Point<T>(x + p2.x, y + p2.y);
  }
  Point<T> operator-(const Point<T> &p2) {
    return Point<T>(x - p2.x, y - p2.y);
  }
};
vector<Point<Point<int> > > usl;
vector<Point<Point<int> > > sl;
bool CanDo(Point<Point<int> > u, Point<Point<int> > s) {
  if (u.x.x == u.y.x) {
    if (u.y.x < s.y.x && u.x.x > s.x.x && u.y.y == s.y.y && u.x.y == s.x.y) {
      sl.push_back(Point<Point<int> >(s.x, u.y));
      sl.push_back(Point<Point<int> >(u.x, s.y));
      return 1;
    } else
      return 0;
  } else if (u.x.y == u.y.y) {
    if (u.y.y < s.y.y && u.x.y > s.x.y && u.y.x == s.y.x && u.x.x == s.x.x) {
      sl.push_back(Point<Point<int> >(s.x, u.y));
      sl.push_back(Point<Point<int> >(u.x, s.y));
      return 1;
    } else
      return 0;
  }
  return 0;
}
int main() {
  int n, w, h;
  cin >> w >> h >> n;
  sl.push_back(Point<Point<int> >(Point<int>(0, 0), Point<int>(w, h)));
  usl.resize(n);
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> usl[i].x.x >> usl[i].x.y >> usl[i].y.x >> usl[i].y.y;
    if (usl[i].y < usl[i].x) swap(usl[i].x, usl[i].y);
  }
  while (!usl.empty()) {
    bool fl = 0;
    for (int(i) = 0; (i) < (usl.size()); (i)++) {
      for (int(j) = 0; (j) < (sl.size()); (j)++) {
        if (CanDo(usl[i], sl[j])) {
          fl = 1;
          usl.erase(usl.begin() + i);
          sl.erase(sl.begin() + j);
          break;
        }
      }
      if (fl) break;
    }
  }
  vector<int> res;
  for (int(i) = 0; (i) < (sl.size()); (i)++) {
    res.push_back((sl[i].y.x - sl[i].x.x) * (sl[i].y.y - sl[i].x.y));
  }
  sort(res.begin(), res.end());
  for (int(i) = 0; (i) < (res.size()); (i)++) {
    cout << res[i] << " ";
  }
  return 0;
}
