#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;
}
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int n, m, k;
vector<
    pair<pair<pair<long long, long long>, pair<long long, long long> >, int> >
    ans;
vector<pair<pair<long long, long long>, pair<long long, long long> > > p;
vector<long long> s;
int dx1[110], dy1[110], dx2[110], dy2[110];
bool use[110];
void dfs(int num, int cx1, int cy1, int cx2, int cy2) {
  bool f1 = false;
  for (int i = 0; i < k; i++) {
    if (dx1[i] >= cx1 && dy1[i] >= cy1 && dx2[i] <= cx2 && dy2[i] <= cy2 &&
        ((dx1[i] == cx1 && dx2[i] == cx2) ||
         (dy1[i] == cy1 && dy2[i] == cy2)) &&
        !use[i]) {
      ans[num] = make_pair(make_pair(pair<long long, long long>(dx1[i], dy1[i]),
                                     pair<long long, long long>(cx2, cy2)),
                           (cx2 - dx1[i]) * (cy2 - dy1[i]));
      ans.push_back(
          make_pair(make_pair(pair<long long, long long>(cx1, cy1),
                              pair<long long, long long>(dx2[i], dy2[i])),
                    (dx2[i] - cx1) * (dy2[i] - cy1)));
      use[i] = true;
      dfs(ans.size() - 1, cx1, cy1, dx2[i], dy2[i]);
      dfs(num, dx1[i], dy1[i], cx2, cy2);
      f1 = true;
      break;
    }
  }
}
int main() {
  cin >> n >> m >> k;
  ans.push_back(make_pair(make_pair(pair<long long, long long>(0, 0),
                                    pair<long long, long long>(n, m)),
                          n * m));
  for (int i = 0; i < (int)(k); i++) {
    cin >> dx1[i] >> dy1[i] >> dx2[i] >> dy2[i];
  }
  dfs(0, ans[0].first.first.first, ans[0].first.first.second,
      ans[0].first.second.first, ans[0].first.second.second);
  s.clear();
  for (int i = 0; i < (int)(ans.size()); i++) {
    s.push_back(ans[i].second);
  }
  sort(s.begin(), s.end());
  for (int i = 0; i < (int)(s.size()); i++) {
    cout << s[i] << endl;
  }
  return 0;
}
