1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <bits/stdc++.h>
#define QCK ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x) cout<<#x<<" "<<x<<endl
#define nd second
#define st first
#define LL long long
using namespace std;

int x, xx, y, yy, maxx, maxy, n, XX, YY, sajzx, sajzy;
vector < pair<int, int > > X, Y;
LL res;
set <int> S;
map < set <int>, int> M;
int main(){
	QCK;
	cin>>n>>XX>>YY;
	X.push_back({0,0}); Y.push_back({0,0});
	
	for(int i=1;i<=n;i++){
		cin>>x>>y>>xx>>yy;
		X.push_back({x,i}); X.push_back({xx,i});
		Y.push_back({y,i}); Y.push_back({yy,i});
	}
	
	X.push_back({XX,n+1}); Y.push_back({YY,n+1});
	sort(X.begin(),X.end()); sort(Y.begin(),Y.end());
	sajzx=X.size(); sajzy=Y.size();
	X[sajzx-1].nd=0;
	Y[sajzy-1].nd=0;
		
	for(int i=0;i<X.size()-1;i++){
		if(S.count(X[i].nd))
			S.erase(X[i].nd);
		else
			S.insert(X[i].nd);
		maxx=max(maxx,M[S]+=X[i+1].st-X[i].st);
	}
		
	S.clear();
	M.clear();
	
	for(int i=0;i<Y.size()-1;i++){
		if(S.count(Y[i].nd))
			S.erase(Y[i].nd);
		else
			S.insert(Y[i].nd);
		maxy=max(maxy,M[S]+=Y[i+1].st-Y[i].st);
	}

	res = (LL)maxx*(LL)maxy;
	
	cout<<res<<endl;
}