#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const double PI = 3.141592653589793;
int w, h, n, x1[105], x2[105], y11[105], y2[105], a[105], b[105], c[105],
    d[105], i, j, k, ind;
vector<int> wek;
bool used[105];
int main() {
  scanf("%d %d %d", &w, &h, &n);
  x1[0] = 0;
  x2[0] = w;
  y11[0] = 0;
  y2[0] = h;
  for (i = 1; i <= n; i++) {
    scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
    used[i] = false;
  }
  for (i = 1; i <= n; i++) {
    ind = -1;
    k = 0;
    while (ind == -1) {
      k++;
      while (used[k]) k++;
      for (j = 0; j < i; j++) {
        if (a[k] == c[k] && a[k] >= x1[j] && c[k] <= x2[j] && b[k] == y11[j] &&
            d[k] == y2[j])
          ind = j;
        if (b[k] == d[k] && a[k] == x1[j] && c[k] == x2[j] && b[k] >= y11[j] &&
            d[k] <= y2[j])
          ind = j;
      }
    }
    used[k] = true;
    if (a[k] == c[k]) {
      x1[i] = a[k];
      x2[i] = x2[ind];
      x2[ind] = a[k];
      y11[i] = y11[ind];
      y2[i] = y2[ind];
    } else {
      y11[i] = b[k];
      y2[i] = y2[ind];
      y2[ind] = b[k];
      x1[i] = x1[ind];
      x2[i] = x2[ind];
    }
  }
  wek.resize(0);
  for (i = 0; i <= n; i++) wek.push_back((x2[i] - x1[i]) * (y2[i] - y11[i]));
  sort(wek.begin(), wek.end());
  for (i = 0; i <= n; i++) printf("%d ", wek[i]);
  printf("\n");
  return 0;
}
