#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void print(T A) {
  cout << "{ ";
  for (__typeof((A).begin()) i = (A).begin(); i != (A).end(); ++i)
    cout << *i << ", ";
  cout << "}" << endl;
}
template <class T>
inline void print2(T A) {
  cout << "{" << endl;
  for (__typeof((A).begin()) i = (A).begin(); i != (A).end(); ++i) {
    cout << " { ";
    for (__typeof((*i).begin()) j = (*i).begin(); j != (*i).end(); j++)
      cout << *j << ", ";
    cout << "}";
    cout << endl;
  }
  cout << "}" << endl;
}
template <class T>
inline void printp(T A) {
  cout << "{ ";
  for (__typeof((A).begin()) i = (A).begin(); i != (A).end(); ++i) {
    cout << "{" << i->first << ", " << i->second << "}";
    cout << ", ";
  }
  cout << " }" << endl;
}
template <class T>
inline void print(T A[], int n) {
  cout << "{ ";
  for (int i = 0; i < n; i++) {
    cout << A[i];
    if (i + 1 < n) cout << ", ";
  }
  cout << " }" << endl;
}
template <class T>
inline void print2(T A[], int n, int m) {
  cout << "{" << endl;
  for (int i = 0; i < n; ++i) {
    cout << " { ";
    for (int j = 0; j < m; ++j) {
      cout << A[i][j];
      if (j + 1 < m) cout << ", ";
    }
    cout << " } " << endl;
  }
  cout << "}" << endl;
}
int main() {
  int w, h, n;
  cin >> w >> h >> n;
  vector<int> v(4);
  v[0] = v[1] = 0;
  v[2] = w;
  v[3] = h;
  set<vector<int> > st;
  st.insert(v);
  int x1, y1, x2, y2;
  vector<vector<int> > a;
  for (int i = 0; i < n; ++i) {
    vector<int> t(4);
    cin >> t[0] >> t[1] >> t[2] >> t[3];
    a.push_back(t);
  }
  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < n; ++i) {
      bool ok = false;
      x1 = a[i][0];
      y1 = a[i][1];
      x2 = a[i][2];
      y2 = a[i][3];
      for (__typeof((st).begin()) i = (st).begin(); i != (st).end(); ++i) {
        if (x1 == x2) {
          if ((*i)[0] < x1 && x1 < (*i)[2] && (*i)[1] == y1 && (*i)[3] == y2) {
            vector<int> v1(4);
            vector<int> v2(4);
            v1[0] = (*i)[0];
            v1[1] = (*i)[1];
            v1[2] = x2;
            v1[3] = y2;
            v2[0] = x1;
            v2[1] = y1;
            v2[2] = (*i)[2];
            v2[3] = (*i)[3];
            st.erase(i);
            st.insert(v1);
            st.insert(v2);
            ok = true;
            break;
          }
        } else {
          if ((*i)[1] < y1 && y1 < (*i)[3] && (*i)[0] == x1 && (*i)[2] == x2) {
            vector<int> v1(4);
            vector<int> v2(4);
            v1[0] = (*i)[0];
            v1[1] = (*i)[1];
            v1[2] = x2;
            v1[3] = y2;
            v2[0] = x1;
            v2[1] = y1;
            v2[2] = (*i)[2];
            v2[3] = (*i)[3];
            st.erase(i);
            st.insert(v1);
            st.insert(v2);
            ok = true;
            break;
          }
        }
      }
      if (ok) break;
    }
  }
  vector<int> res;
  for (__typeof((st).begin()) i = (st).begin(); i != (st).end(); ++i) {
    int area = ((*i)[2] - (*i)[0]) * ((*i)[3] - (*i)[1]);
    res.push_back(area);
  }
  sort((res).begin(), (res).end());
  for (int i = 0; i < (int)(res).size(); ++i) {
    if (i) cout << " ";
    cout << res[i];
  }
  cout << endl;
}
