#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
long long n, m, k;
bool con[101][101][4];
bool used[101][101];
vector<int> ans;
int dfs(int x, int y) {
  if (x < 0 || x >= n || y < 0 || y >= m || used[x][y]) return 0;
  int ans = 1;
  used[x][y] = 1;
  for (long long i = 0; i < (4); i++) {
    if (con[x][y][i]) {
      ans += dfs(x + dx[i], y + dy[i]);
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  memset(used, 0, sizeof(used));
  ;
  memset(con, 1, sizeof(con));
  cin >> n >> m >> k;
  int x1, y1, x2, y2;
  for (long long i = 0; i < (k); i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2) {
      for (long long j = (y1); j < (y2); j++) {
        con[x1 - 1][j][0] = con[x1][j][1] = 0;
      }
    } else {
      for (long long j = (x1); j < (x2); j++) {
        con[j][y1 - 1][2] = con[j][y1][3] = 0;
      }
    }
  }
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (m); j++) {
      if (!used[i][j]) {
        ans.push_back(dfs(i, j));
      }
    }
  }
  sort(ans.begin(), ans.end());
  for (long long i = 0; i < (ans.size()); i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
