#include<bits/stdc++.h>

using namespace std;

typedef long long LL;

struct BIT{
    vector<LL> node;
    int size;

    BIT(int n){
        size=n;
        node.resize(size,0);
    }

    void add(int a,int x){
        for(int i=a;i<size;i|=i+1) node[i]+=x;
    }

    LL sum(int a){
        LL res=0;
        for(int i=a-1;i>=0;i=(i&(i+1))-1){
            res+=node[i];
        }
        return res;
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int h,w,m;
    cin>>h>>w>>m;

    vector<int> x(m),y(m);
    for(int i=0;i<m;i++){
        cin>>x[i]>>y[i];
        x[i]--,y[i]--;
    }

    int clsh=h,clsw=w;
    for(int i=0;i<m;i++){
        if(x[i]==0) clsw=min(clsw,y[i]);
        if(y[i]==0) clsh=min(clsh,x[i]);
    }

    vector<int> rih(clsh,w);
    for(int i=0;i<m;i++){
        if(x[i]<clsh) rih[x[i]]=min(rih[x[i]],y[i]);
    }
    vector<int> riw(clsw,h);
    for(int i=0;i<m;i++){
        if(y[i]<clsw) riw[y[i]]=min(riw[y[i]],x[i]);
    }

    LL res=0;
    for(int i=0;i<clsh;i++) res+=rih[i];
    for(int i=0;i<clsw;i++) res+=riw[i];

    vector<vector<int>> dels(w+1);
    for(int i=0;i<clsh;i++) dels[rih[i]].push_back(i);

    BIT bt(h);
    for(int i=0;i<clsh;i++) bt.add(i,1);
    for(int i=0;i<clsw;i++){
        for(int d:dels[i]) bt.add(d,-1);
        res-=bt.sum(riw[i]);
    }

    cout<<res;

    return 0;
}
#include <bits/stdc++.h>
#define ll long long

using namespace std;
#define MAX 1000000007


int nCrModpDP(int n, int r, int p)
{
    // The array C is going to store last row of
    // pascal triangle at the end. And last entry
    // of last row is nCr
    int C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1; // Top row of Pascal Triangle

    // One by constructs remaining rows of Pascal
    // Triangle from top to bottom
    for (int i = 1; i <= n; i++)
    {
        // Fill entries of current row using previous
        // row values
        for (int j = min(i, r); j > 0; j--)

            // nCj = (n-1)Cj + (n-1)C(j-1);
            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

// Lucas Theorem based function that returns nCr % p
// This function works like decimal to binary conversion
// recursive function.  First we compute last digits of
// n and r in base p, then recur for remaining digits
int nCrModpLucas(int n, int r, int p)
{
   // Base case
   if (r==0)
      return 1;

   // Compute last digits of n and r in base p
   int ni = n%p, ri = r%p;

   // Compute result for last digits computed above, and
   // for remaining digits.  Multiply the two results and
   // compute the result of multiplication in modulo p.
   return (nCrModpLucas(n/p, r/p, p) * // Last digits of n and r
           nCrModpDP(ni, ri, p)) % p;  // Remaining digits
}
int main(){

	ios::sync_with_stdio(0), cin.tie(0);
    ll n,s,d;
    cin>>n>>s>>d;
    ll x,y;
    ll test=0;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        if((x<s)and(y>d))
            test=1;
    }
    if(test==1)
        cout<<"Yes";
    else
        cout<<"No";
    return(0);
}
