#include <bits/stdc++.h>
using namespace std;
int w, h, n, res[105], resc;
bool a[105][105][2], v[105][105];
int main() {
  int x1, y1, x2, y2;
  scanf("%d %d %d", &w, &h, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    if (x1 == x2)
      for (int j = y1; j < y2; j++) a[x1 - 1][j][0] = true;
    else
      for (int j = x1; j < x2; j++) a[j][y1 - 1][1] = true;
  }
  for (int i = 0; i < h; i++) a[w - 1][i][0] = true;
  for (int i = 0; i < w; i++) a[i][h - 1][1] = true;
  for (int i = 0; i < w; i++)
    for (int j = 0; j < h; j++)
      if (!v[i][j]) {
        x1 = x2 = i;
        y1 = y2 = j;
        while (!a[x2][y1][0]) x2++;
        while (!a[x1][y2][1]) y2++;
        res[resc++] = (x2 - x1 + 1) * (y2 - y1 + 1);
        for (int i1 = x1; i1 <= x2; i1++)
          for (int j1 = y1; j1 <= y2; j1++) v[i1][j1] = true;
        j = y2;
      }
  sort(res, res + resc);
  for (int i = 0; i < resc; i++) printf("%d ", res[i]);
  return 0;
}
