#include <bits/stdc++.h>
using namespace std;
const int maxn = 102;
int w, h, n, qs, qt;
int area[maxn], areath;
pair<int, int> q[1000006];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
bool vis[maxn][maxn];
bool cut[maxn][maxn][4];
int bfs(int stx, int sty) {
  qs = 0;
  qt = 1;
  q[0] = make_pair(stx, sty);
  while (qs < qt) {
    int nowx = q[qs].first;
    int nowy = q[qs++].second;
    for (int k = 0; k < 4; k++)
      if (!cut[nowx][nowy][k]) {
        int x = nowx + dx[k], y = nowy + dy[k];
        if (x < 0 || x >= w || y < 0 || y >= h || vis[x][y]) continue;
        vis[x][y] = true;
        q[qt++] = make_pair(x, y);
      }
  }
  return qt;
}
int main() {
  cin >> w >> h >> n;
  for (int i = 1; i <= n; i++) {
    int xa, ya, xb, yb;
    cin >> xa >> ya >> xb >> yb;
    if (xa == xb)
      for (int j = ya; j < yb; j++) cut[xa][j][0] = cut[xa - 1][j][2] = true;
    else
      for (int j = xa; j < xb; j++) cut[j][ya][1] = cut[j][ya - 1][3] = true;
  }
  for (int i = 0; i < w; i++)
    for (int j = 0; j < h; j++)
      if (!vis[i][j]) {
        vis[i][j] = true;
        area[++areath] = bfs(i, j);
      }
  sort(area + 1, area + areath + 1);
  for (int i = 1; i < areath; i++) cout << area[i] << " ";
  cout << area[areath] << endl;
  return 0;
}
