#include <bits/stdc++.h>
using namespace std;
bool use[105][105];
bool bge[105][105][4];
int n, m, gs, nm;
vector<int> v;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
inline void dfs(int x, int y) {
  if (x < 0 || y < 0 || x == n || y == m || use[x][y]) return;
  use[x][y] = 1;
  nm++;
  for (int i = 0; i < 4; i++)
    if (!bge[x][y][i]) dfs(x + dx[i], y + dy[i]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> gs;
  int i, j, k, x1, y1, x2, y2;
  for (k = 0; k < gs; k++) {
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2) {
      for (i = y1; i < y2; i++) bge[x1 - 1][i][0] = bge[x1][i][1] = 1;
    } else {
      for (i = x1; i < x2; i++) bge[i][y1 - 1][2] = bge[i][y1][3] = 1;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (!use[i][j]) {
        nm = 0;
        dfs(i, j);
        v.push_back(nm);
      }
    }
  }
  sort(v.begin(), v.end());
  for (i = 0; i < v.size(); i++)
    cout << v[i] << (i == v.size() - 1 ? '\n' : ' ');
  cout << endl;
  return 0;
}
