#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long b,
                 long long mod = (long long)(1e9 + 7)) {
  if (!b) return 1;
  a %= mod;
  return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1, mod) % mod;
}
int di[4] = {1, -1, 0, 0}, dj[4] = {0, 0, 1, -1};
set<int> adj[101][101];
int dfs(int x, int y, bool vis[100][100]) {
  vis[x][y] = true;
  int sz = 1;
  for (int t : adj[x][y]) {
    int nx = x + di[t], ny = y + dj[t];
    if (!vis[nx][ny]) {
      sz += dfs(nx, ny, vis);
    }
  }
  return sz;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int k, n, m;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      for (int x = 0; x < 4; x++)
        if ((0 <= i + di[x] && i + di[x] <= n - 1) &&
            (0 <= j + dj[x] && j + dj[x] <= m - 1))
          adj[i][j].insert(x);
  for (int i = 0; i < k; i++) {
    int x0, y0, x1, y1;
    cin >> x0 >> y0 >> x1 >> y1;
    if (x0 == x1) {
      x0--, x1--;
      if (y0 > y1) swap(y0, y1);
      for (int y = y0; y <= y1 - 1; y++)
        adj[x0][y].erase(0), adj[x0 + 1][y].erase(1);
    } else {
      y0--, y1--;
      if (x0 > x1) swap(x0, x1);
      for (int x = x0; x <= x1 - 1; x++)
        adj[x][y0].erase(2), adj[x][y0 + 1].erase(3);
    }
  }
  vector<int> ans;
  bool vis[100][100];
  memset(vis, false, sizeof(vis));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!vis[i][j]) ans.push_back(dfs(i, j, vis));
  sort(ans.begin(), ans.end());
  for (int w : ans) cout << w << " ";
  cout << endl;
  return 0;
}
