#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool read(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
const int INF = 2e9;
const int MX = 105;
const int MOD = 1000000007;
const double PI = acos(-1.0);
struct edge {
  bool l, r, u, d;
  edge(){};
  edge(bool l, bool r, bool u, bool d) : l(l), r(r), u(u), d(d){};
};
edge e[MX][MX];
int w, h, n;
bool visited[MX][MX];
int dfs(int x, int y) {
  if (x < 0 || x == w) return 0;
  if (y < 0 || y == h) return 0;
  if (visited[x][y]) return 0;
  visited[x][y] = true;
  int ret = 1;
  if (e[x][y].l) ret += dfs(x - 1, y);
  if (e[x][y].r) ret += dfs(x + 1, y);
  if (e[x][y].u) ret += dfs(x, y + 1);
  if (e[x][y].d) ret += dfs(x, y - 1);
  return ret;
}
int main() {
  memset(e, true, sizeof(e));
  w = ({
    int a;
    read(a);
    a;
  });
  h = ({
    int a;
    read(a);
    a;
  });
  n = ({
    int a;
    read(a);
    a;
  });
  for (int i = 0; i < n; i++) {
    int x1 = ({
      int a;
      read(a);
      a;
    }),
        y1 = ({
          int a;
          read(a);
          a;
        }),
        x2 = ({
          int a;
          read(a);
          a;
        }),
        y2 = ({
          int a;
          read(a);
          a;
        });
    if ((x1 == 0 && x2 == 0) || (x1 == w && x2 == w) || (y1 == 0 && y2 == 0) ||
        (y1 == h && y2 == h))
      continue;
    if (x1 == x2) {
      for (int j = y1; j < y2; j++) {
        e[x1 - 1][j].r = false;
        e[x1][j].l = false;
      }
    } else {
      for (int j = x1; j < x2; j++) {
        e[j][y1 - 1].u = false;
        e[j][y1].d = false;
      }
    }
  }
  memset(visited, false, sizeof(visited));
  vector<int> v;
  for (int i = 0; i < w; i++)
    for (int j = 0; j < h; j++)
      if (!visited[i][j]) v.push_back(dfs(i, j));
  sort(v.begin(), v.end());
  for (int i = 0; i < (int)v.size(); i++) printf("%d ", v[i]);
  return 0;
}
