#include <bits/stdc++.h>
using namespace std;
vector<int> ans;
bool hor[101][101][101];
bool ver[101][101][101];
void calculateArea(int x1, int y1, int x2, int y2) {
  for (int i = x1 + 1; i < x2; i++) {
    if (ver[i][y1][y2]) {
      calculateArea(x1, y1, i, y2);
      calculateArea(i, y1, x2, y2);
      return;
    }
  }
  for (int i = y1 + 1; i < y2; i++) {
    if (hor[i][x1][x2]) {
      calculateArea(x1, y1, x2, i);
      calculateArea(x1, i, x2, y2);
      return;
    }
  }
  ans.push_back((x2 - x1) * (y2 - y1));
}
int main() {
  int w, h, n;
  cin >> w >> h >> n;
  int x1, y1, x2, y2;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2) {
      ver[x1][y1][y2] = true;
    } else
      hor[y1][x1][x2] = true;
  }
  calculateArea(0, 0, w, h);
  sort(ans.begin(), ans.end());
  vector<int>::iterator itr;
  for (itr = ans.begin(); itr < ans.end(); itr++) {
    cout << *itr << " ";
  }
  cout << endl;
}
