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
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define dbl(k, x) fixed << setprecision(k) << (x)

template < typename _T > inline void _DBG(const char *s, _T x) { cerr << s << " = " << x << "\n"; }
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a) { while(*s != ',') cerr << *s++; cerr << " = " << x << ','; _DBG(s + 1, a...); }

#ifdef LOCAL
#define _upgrade ios_base::sync_with_stdio(0);
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DBG(...) (__VA_ARGS__)
#define cerr if(0) cout
#endif

// ********************** CODE ********************** //

typedef unsigned long long ULL;

mt19937_64 rng(1998);

ULL randULL() 
{
    return uniform_int_distribution < ULL > (0, ULLONG_MAX)(rng);
}

const int N = 5e5 + 7;

struct rect {
    int x1, x2, y1, y2;
};

int n, X, Y;
vector < pair < int, ULL > > vec[2];

int main()
{
    _upgrade
    
    cin >> n >> X >> Y;
    
    for(int i = 0; i < n; i++)
    {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        
        if(x1 > x2) swap(x1, x2);
        if(y1 > y2) swap(y1, y2);

        ULL v = randULL();

        vec[0].push_back({x1, v});
        vec[0].push_back({x2, v});

        vec[1].push_back({y1, v});
        vec[1].push_back({y2, v});
    }

    vec[0].push_back({X, 0});
    vec[0].push_back({0, 0});
    vec[1].push_back({Y, 0});
    vec[1].push_back({0, 0});

    LL ans = 1;
    for(int t = 0; t < 2; t++)
    {
        sort(all(vec[t]));
        vector < pair < ULL, int > > len;
        ULL xr = 0;
        int last = 0;
        for(int i = 0; i < sz(vec[t]); i++)
        {
            xr ^= vec[t][i].second;
            if(i + 1 < sz(vec[t]) && vec[t][i].first != vec[t][i + 1].first)
            {
                len.push_back({xr, vec[t][i + 1].first - last});
                last = vec[t][i + 1].first;
            }
        }
        
        sort(all(len));
        int mx = 0;
        last = 0;
        for(int i = 0; i <= sz(len); i++)
        {
            if(i == sz(len) || (i > 0 && len[i - 1].first != len[i].first))
            {
                mx = max(mx, last);
                last = 0;
            }
            if(i < sz(len))
                last += len[i].second;
        }
        ans *= (LL)mx;
    }
    cout << ans << "\n";

	return 0;
}