#include <bits/stdc++.h>   using namespace std;   struct Rectangle {     int x1;     int x2;     int y1;     int y2;     Rectangle() {}     Rectangle(int a, int b, int c, int d) {       x1 = a;       y1 = b;       x2 = c;       y2 = d;       if (x1 > x2) {         swap(x1, x2);       }       if (y1 > y2) {         swap(y1, y2);       }     }     bool operator<(Rectangle r) const {       if (x1 != r.x1) {         return x1 < r.x1;       } else if (x2 != r.x2) {         return x2 < r.x2;       } else if (y1 != r.y1) {         return y1 < r.y1;       } else {         return y2 < r.y2;       }     }   };   int Area(Rectangle r) { return (r.x2 - r.x1) * (r.y2 - r.y1); }   set<Rectangle> rec;   set<Rectangle> lines;   int main() {     int W, H, N;     scanf( %d , &W);     ;     scanf( %d , &H);     ;     scanf( %d , &N);     ;     rec.insert(Rectangle(0, 0, W, H));     for (int(n) = 0; n < (int)N; n++) {       int a, b, c, d;       scanf( %d , &a);       ;       scanf( %d , &b);       ;       scanf( %d , &c);       ;       scanf( %d , &d);       ;       lines.insert(Rectangle(a, b, c, d));     }     for (int(n) = 0; n < (int)N; n++) {       for (__typeof(rec).begin() t = rec.begin(); t != rec.end(); t++) {         Rectangle r = *t;         for (__typeof(lines).begin() it = lines.begin(); it != lines.end();              it++) {           if (it->x1 == it->x2) {             if (r.x1 < it->x1 && it->x2 < r.x2 && r.y1 == it->y1 &&                 r.y2 == it->y2) {               lines.erase(lines.find(*it));               rec.erase(*t);               rec.insert(Rectangle(r.x1, r.y1, it->x2, r.y2));               rec.insert(Rectangle(it->x2, r.y1, r.x2, r.y2));               goto end;             }           } else if (it->y1 == it->y2) {             if (r.y1 < it->y1 && it->y2 < r.y2 && r.x1 == it->x1 &&                 r.x2 == it->x2) {               lines.erase(lines.find(*it));               rec.erase(*t);               rec.insert(Rectangle(r.x1, r.y1, r.x2, it->y1));               rec.insert(Rectangle(r.x1, it->y1, r.x2, r.y2));               goto end;             }           }         }       }     end:       int sol = 42;     }     vector<int> res;     for (__typeof(rec).begin() it = rec.begin(); it != rec.end(); it++) {       res.push_back(Area(*it));     }     sort(res.begin(), res.end());     for (__typeof(res).begin() it = res.begin(); it != res.end(); it++) {       printf(  %d , *it);     }     printf(  n );     return 0;   }   