/*
	Author : $%U%$
	Time : $%h%$:$%m%$:$%s%$, $%D%$/$%M%$/$%Y%$
*/


#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!

using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;

using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>; 
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>; 
using vpd = vector<pd>;

#define tcT template<class T
#define tcTU tcT, class U
// ^ lol this makes everything look weird but I'll try it
tcT> using V = vector<T>; 
tcT, size_t SZ> using AR = array<T,SZ>; 
tcT> using PR = pair<T,T>;

// pairs
#define mp make_pair
#define f first
#define s second

// vectors
// oops size(x), rbegin(x), rend(x) need C++17
#define sz(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define rall(x) x.rbegin(), x.rend() 
#define sor(x) sort(all(x)) 
#define rsz resize
#define ins insert 
#define ft front()
#define bk back()
#define pb push_back
#define eb emplace_back 
#define pf push_front

#define lb lower_bound
#define ub upper_bound 
tcT> int lwb(V<T>& a, const T& b) { return int(lb(all(a),b)-bg(a)); }

// loops
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18; // not too close to LLONG_MAX
const db PI = acos((db)-1);
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!!
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;

// bitwise ops
// also see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
constexpr int pct(int x) { return __builtin_popcount(x); } // # of bits set
constexpr int bits(int x) { // assert(x >= 0); // make C++11 compatible until USACO updates ...
	return x == 0 ? 0 : 31-__builtin_clz(x); } // floor(log2(x)) 
constexpr int p2(int x) { return 1<<x; }
constexpr int msk2(int x) { return p2(x)-1; }

ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down

tcT> bool ckmin(T& a, const T& b) {
	return b < a ? a = b, 1 : 0; } // set a = min(a,b)
tcT> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; }

tcTU> T fstTrue(T lo, T hi, U f) {
	hi ++; assert(lo <= hi); // assuming f is increasing
	while (lo < hi) { // find first index such that f is true 
		T mid = lo+(hi-lo)/2;
		f(mid) ? hi = mid : lo = mid+1; 
	} 
	return lo;
}
tcTU> T lstTrue(T lo, T hi, U f) {
	lo --; assert(lo <= hi); // assuming f is decreasing
	while (lo < hi) { // find first index such that f is true 
		T mid = lo+(hi-lo+1)/2;
		f(mid) ? lo = mid : hi = mid-1;
	} 
	return lo;
}
tcT> void remDup(vector<T>& v) { // sort and remove duplicates
	sort(all(v)); v.erase(unique(all(v)),end(v)); }
tcTU> void erase(T& t, const U& u) { // don't erase
	auto it = t.find(u); assert(it != end(t));
	t.erase(it); } // element that doesn't exist from (multi)set

#define el '\n'


void solve()
{
	ll n,S,D; cin>>n>>S>>D;
    bool flag=false;
    for(int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        if(x<S and y>D)
        {
            flag=true;
        }
    }
    if(flag) cout<<"Yes"<<el;
    else cout<<"No"<<el;
}

int main() 
{ 
    cin.tie(0)->sync_with_stdio(0);
    
    int ct=1;
    // cin>>ct;
    while(ct--)
    {
        solve();
    } 

}
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 200005;
int seg[4*N],h;
void update(int idx,int p=1,int s=0,int e=h)
{
    if(s==e)
    {
        seg[p] = 1;
        return;
    }
    int mid = (s+e)>>1;
    if(idx<=mid)
        update(idx,2*p,s,mid);
    else
        update(idx,2*p+1,mid+1,e);
    seg[p] = seg[2*p] + seg[2*p+1];
}
int get(int l,int r,int p=1,int s=0,int e=h)
{
    if(r<s||l>e)
        return 0;
    if(l<=s&&e<=r)
        return seg[p];
    int mid = (s+e)>>1;
    return get(l,r,p<<1,s,mid)+get(l,r,p<<1|1,mid+1,e);
}
void solve()
{
    int w, m;
    cin>>h>>w>>m;
    vector<pair<int,int>> v(m);
    for(int i=0;i<m;i++)
    {
        cin>>v[i].first>>v[i].second;
        v[i].first--;
        v[i].second--;
    }
    sort(v.begin(),v.end());

    vector<vector<int>> by_row(h), by_col(w);
    for (auto &it : v)
    {
        by_row[it.first].push_back(it.second);
        by_col[it.second].push_back(it.first);
    }
    for (int x = 0; x < h; x++)
        by_row[x].push_back(w);
    for (int y = 0; y < w; y++)
        by_col[y].push_back(h);

    int reachable_rows = by_col[0].front();
    int reachable_cols = by_row[0].front();

    ll ans = 0;
    for (int x = 0; x < reachable_rows; x++)
        ans += by_row[x].front();
    for (int y = 1; y < reachable_cols; y++)
    {
        int height = by_col[y].front();

        ans += max(0, height - reachable_rows);

        int x = min(reachable_rows, height);
        ans += get(0,x-1);

        for (int it : by_col[y])
            update(it);
    }
    cout<<ans<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false),cin.tie(0);
    solve();
    return 0;
}
