#include <bits/stdc++.h>
using namespace std;
int N, W, H;
vector<int> a;
int x1[105], Y1[105], x2[105], y2[105];
void solve(int xj, int yj, int xs, int ys) {
  for (int i = 1; i <= N; ++i)
    if (Y1[i] == yj && y2[i] == ys && x1[i] > xj && x1[i] < xs) {
      assert(x1[i] == x2[i]);
      solve(xj, yj, x2[i], y2[i]);
      solve(x1[i], Y1[i], xs, ys);
      return;
    } else if (x1[i] == xj && x2[i] == xs && yj < Y1[i] && Y1[i] < ys) {
      assert(Y1[i] == y2[i]);
      solve(xj, yj, x2[i], y2[i]);
      solve(x1[i], Y1[i], xs, ys);
      return;
    }
  a.push_back((xs - xj) * (ys - yj));
}
int main() {
  int i;
  cin >> W >> H >> N;
  for (i = 1; i <= N; ++i) cin >> x1[i] >> Y1[i] >> x2[i] >> y2[i];
  solve(0, 0, W, H);
  sort(a.begin(), a.end());
  for (i = 0; i < (int)a.size(); ++i) cout << a[i] << " ";
  return 0;
}
