#include <bits/stdc++.h>
using namespace std;
int W, H, n;
set<pair<int, int> > coll;
set<pair<int, int> >::iterator pos;
vector<vector<int> > order(100 * 100 + 1);
int get(int x, int y) { return (y - 1) * W + x; }
void Build() {
  int x, y, v;
  for (y = 1; y <= H; y++) {
    for (x = 1; x <= W; x++) {
      v = get(x, y);
      if (x != W) coll.insert(make_pair(v, v + 1));
      if (y != H) coll.insert(make_pair(v, v + W));
    }
  }
}
void DEL(int x1, int y1, int x2, int y2) {
  int x, y;
  if (y1 == y2) {
    for (x = x1 + 1; x <= x2; x++) {
      coll.erase(make_pair((y1 - 1) * W + x, y1 * W + x));
    }
  }
  if (x1 == x2) {
    for (y = y1 + 1; y <= y2; y++) {
      coll.erase(make_pair((y - 1) * W + x1, (y - 1) * W + x1 + 1));
    }
  }
}
void Transform() {
  for (pos = coll.begin(); pos != coll.end(); pos++) {
    order[pos->first].push_back(pos->second);
    order[pos->second].push_back(pos->first);
  }
}
void ReadData() {
  cin >> W >> H >> n;
  Build();
  int i, x1, y1, x2, y2;
  for (i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    DEL(x1, y1, x2, y2);
  }
}
vector<bool> flag(100 * 100 + 1, false);
void dfs(int k, int &u) {
  u++;
  flag[k] = true;
  int q, to;
  for (q = 0; q < order[k].size(); q++) {
    to = order[k][q];
    if (!flag[to]) dfs(to, u);
  }
}
int main() {
  ReadData();
  Transform();
  int i, u;
  vector<int> answeR;
  for (i = 1; i <= W * H; i++) {
    if (!flag[i]) {
      u = 0;
      dfs(i, u);
      answeR.push_back(u);
    }
  }
  sort(answeR.begin(), answeR.end());
  for (i = 0; i < answeR.size(); i++) cout << answeR[i] << " ";
  return 0;
}
