#include <bits/stdc++.h>
using namespace std;
struct p {
  int xmin, xmax, ymin, ymax;
  p(int xmin, int xmax, int ymin, int ymax)
      : xmin(xmin), xmax(xmax), ymin(ymin), ymax(ymax) {
    ;
  }
};
vector<int> res;
vector<p> mas;
int fl[110];
int w, h, n, xx1[110], xx2[110], yy1[110], yy2[110];
int main() {
  scanf("%d%d%d", &w, &h, &n);
  mas.push_back(p(0, w, 0, h));
  for (int i = 0; i < n; i++)
    scanf("%d%d%d%d", &xx1[i], &yy1[i], &xx2[i], &yy2[i]);
  while (mas.size() != n + 1) {
    for (int i = 0; i < n; i++) {
      if (fl[i]) continue;
      int xmi = min(xx1[i], xx2[i]);
      int xma = max(xx1[i], xx2[i]);
      int ymi = min(yy1[i], yy2[i]);
      int yma = max(yy1[i], yy2[i]);
      for (int j = 0; j < mas.size(); j++) {
        if (xmi >= mas[j].xmin && xma <= mas[j].xmax && ymi >= mas[j].ymin &&
            yma <= mas[j].ymax) {
          if (xmi == xma) {
            if (ymi != mas[j].ymin || yma != mas[j].ymax) continue;
            int tmp = mas[j].xmax;
            mas[j].xmax = xma;
            mas.push_back(p(xmi, tmp, ymi, yma));
          } else {
            if (xmi != mas[j].xmin || xma != mas[j].xmax) continue;
            int tmp = mas[j].ymax;
            mas[j].ymax = yma;
            mas.push_back(p(xmi, xma, ymi, tmp));
          }
          fl[i] = 1;
          break;
        }
      }
    }
  }
  for (int i = 0; i < mas.size(); i++)
    res.push_back((mas[i].xmax - mas[i].xmin) * (mas[i].ymax - mas[i].ymin));
  sort(res.begin(), res.end());
  for (int i = 0; i < res.size(); i++) printf("%d ", res[i]);
  return 0;
}
