#include <bits/stdc++.h>
using namespace std;
long long pn, piece[105][4];
void addpiece(long long xa, long long ya, long long xb, long long yb) {
  piece[pn][0] = xa;
  piece[pn][1] = ya;
  piece[pn][2] = xb;
  piece[pn++][3] = yb;
}
bool trycut(long long i, long long xa, long long ya, long long xb,
            long long yb) {
  if (xa == xb) {
    if (piece[i][3] == yb && piece[i][1] == ya && piece[i][0] < xa &&
        piece[i][2] > xa) {
      addpiece(piece[i][0], piece[i][1], xa, piece[i][3]);
      piece[i][0] = xa;
      return 1;
    }
  } else {
    if (piece[i][2] == xb && piece[i][0] == xa && piece[i][3] > ya &&
        piece[i][1] < ya) {
      addpiece(piece[i][0], piece[i][1], piece[i][2], ya);
      piece[i][1] = ya;
      return 1;
    }
  }
  return 0;
}
long long cut[105][4], w, h, n;
signed main() {
  cin >> w >> h >> n;
  addpiece(0, 0, w, h);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < 4; j++) cin >> cut[i][j];
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++)
      for (long long k = 0; k < pn; k++)
        if (trycut(k, cut[j][0], cut[j][1], cut[j][2], cut[j][3])) break;
  long long ans[105];
  for (long long i = 0; i < pn; i++)
    ans[i] = (piece[i][3] - piece[i][1]) * (piece[i][2] - piece[i][0]);
  sort(ans, ans + pn);
  for (long long i = 0; i < pn; i++) cout << ans[i] << ' ';
  return 0;
}
