#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int X1[127], X2[128], Y1[111], Y2[105];
bool u[134][134];
vector<int> res;
int check(int xx1, int yy1, int x2, int y2) {
  if (x2 < 0 || y2 < 0 || x2 >= n || y2 >= m || u[x2][y2]) return 0;
  if (xx1 > x2) swap(xx1, x2);
  if (yy1 > y2) swap(yy1, y2);
  if (xx1 != x2) {
    xx1++;
    y2++;
  } else {
    x2++;
    yy1++;
  }
  for (int i = 0; i < k; i++) {
    int x3 = max(xx1, X1[i]);
    int y3 = max(yy1, Y1[i]);
    int x4 = min(x2, X2[i]);
    int y4 = min(y2, Y2[i]);
    if (x3 < x4 && y3 <= y4 || x3 <= x4 && y3 < y4) return 0;
  }
  return 1;
}
int go(int i, int j) {
  int t = 1;
  u[i][j] = 1;
  if (check(i, j, i + 1, j)) t += go(i + 1, j);
  if (check(i, j, i - 1, j)) t += go(i - 1, j);
  if (check(i, j, i, j + 1)) t += go(i, j + 1);
  if (check(i, j, i, j - 1)) t += go(i, j - 1);
  return t;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < k; i++) cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!u[i][j]) res.push_back(go(i, j));
  sort(res.begin(), res.end());
  for (int i = 0; i < res.size(); i++) cout << res[i] << " ";
  return 0;
}
