#include <bits/stdc++.h>
using namespace std;
struct aaa {
  int x1, y1, x2, y2;
  bool vuk;
};
bool p[106][106];
int f[110][110];
int w, h, n;
aaa v[109];
int main() {
  memset(f, -1, sizeof(f));
  scanf("%d %d %d", &w, &h, &n);
  for (int i = 1; i <= h; i++)
    for (int j = 1; j <= w; j++) f[i][j] = 0;
  for (int i = 0; i <= h; i++) p[i][0] = p[i][w] = true;
  for (int j = 0; j <= w; j++) p[0][j] = p[h][j] = true;
  for (int i = 0; i < n; i++) {
    v[i].vuk = false;
    scanf("%d %d %d %d", &v[i].x1, &v[i].y1, &v[i].x2, &v[i].y2);
  }
  int top = 1;
  for (int k = 0; k < n; k++) {
    int z = 0;
    while (!(p[v[z].y1][v[z].x1] && p[v[z].y2][v[z].x2] && v[z].vuk == false))
      z++;
    v[z].vuk = true;
    int x1 = v[z].x1;
    int y_1 = v[z].y1;
    int x2 = v[z].x2;
    int y_2 = v[z].y2;
    if (y_1 == y_2) {
      int y = y_1;
      if (x1 > x2) swap(x1, x2);
      for (int j = x1; j <= x2; j++) p[y][j] = true;
      for (int j = x1 + 1; j <= x2; j++) {
        int tmp = f[y][j];
        int i = y;
        while (f[i][j] == tmp) {
          f[i][j] = top;
          i--;
        }
        tmp = f[y + 1][j];
        i = y + 1;
        while (f[i][j] == tmp) {
          f[i][j] = top + 1;
          i++;
        }
      }
      top += 2;
    } else {
      int x = x1;
      if (y_1 > y_2) swap(y_1, y_2);
      for (int i = y_1; i <= y_2; i++) p[i][x] = true;
      for (int i = y_1 + 1; i <= y_2; i++) {
        int tmp = f[i][x];
        int j = x;
        while (f[i][j] == tmp) {
          f[i][j] = top;
          j--;
        }
        tmp = f[i][x + 1];
        j = x + 1;
        while (f[i][j] == tmp) {
          f[i][j] = top + 1;
          j++;
        }
      }
      top += 2;
    }
  }
  map<int, int> m;
  m.clear();
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      m[f[i][j]]++;
    }
  }
  vector<int> vec;
  vec.clear();
  map<int, int>::iterator it;
  for (it = m.begin(); it != m.end(); it++) vec.push_back((*it).second);
  sort(vec.begin(), vec.end());
  printf("%d", vec[0]);
  for (int i = 1; i < (int)vec.size(); i++) printf(" %d", vec[i]);
  printf("\n");
  return 0;
}
