#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  short negative = 1;
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') negative = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  x *= negative;
}
inline void write(long long x) {
  static long long sta[35];
  long long top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + 48);
  puts("");
}
bool prime(int n) {
  if (n == 0 || n == 1) return false;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
int cnt;
bool use[111][111];
bool eadge[111][111][4];
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
vector<long long> s;
int ans;
int n, m, k;
void dfs(int x, int y) {
  if (x < 0 || x >= n || y < 0 || y >= m || use[x][y]) return;
  use[x][y] = true;
  ans++;
  for (int i = 0; i < 4; i++) {
    if (!eadge[x][y][i]) {
      dfs(x + dx[i], y + dy[i]);
    }
  }
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= k; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2) {
      for (int j = y1; j < y2; j++) {
        eadge[x1 - 1][j][0] = 1;
        eadge[x1][j][2] = 1;
      }
    } else if (y1 == y2) {
      for (int j = x1; j < x2; j++) {
        eadge[j][y1 - 1][1] = 1;
        eadge[j][y1][3] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!use[i][j]) {
        ans = 0;
        dfs(i, j);
        s.push_back(ans);
      }
    }
  }
  sort(s.begin(), s.end());
  for (int i = 0; i < s.size(); i++) {
    cout << s[i] << endl;
  }
  return 0;
}
