#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define llu unsigned long long
    #define ld double
    #define llu unsigned long long
    #define rep(i,x,y)  for(ll i=(ll)(x);i<(ll)(y);++i)
    #define For(i,x,y)  for(ll i=(ll)(x);i<=(ll)(y);++i)
    #define FOr(i,x,y)  for(ll i=(ll)(x);i>=(ll)(y);--i)
    #define pi acos(-1) 
    #define mk make_pair
    #define pa pair<ll,ll>
    #define lf else if
    #define IL inline
    #define max(x,y)    ((x)<(y)?(y):(x))
    #define min(x,y)    ((x)<(y)?(x):(y))
    #define sqr(x)      ((x)*(x))
    #define Mul(x,y)    ((x)=1LL*(x)*(y)%mod)
    #define Add(x,y)    ((x)=((x)+(y))%mod)
    #define E(x)        return writeln(x),0
    #define LL			(long long)
    #define p(x)        printf("~%lld~\n",LL(x))
    #define pp(x,y)     printf("~~%lld %lld~~\n",LL(x),LL(y))
    #define ppp(x,y,z)  printf("~~~%lld %lld %lld~~~\n",LL(x),LL(y),LL(z))
    #define pppp(a,b,c,d)	printf("~~~%lld %lld %lld %lld\n",LL(a),LL(b),LL(c),LL(d))
    #define f_in(x)     freopen(x".in","r",stdin)
    #define f_out(x)    freopen(x".out","w",stdout)
    #define open(x)     f_in(x),f_out(x)
    #define fi first
    #define se second
    #define GuYue		puts("\nGuYueNa________________________________________________________________________________")
    #define y1			fafa____
    typedef complex<double> E;
    namespace SHENZHEBEI{
    #ifdef LOCAL
        struct _{_(){freopen("cf.in","r",stdin);}}_; 
    #endif 
    #define NEG 1
        static const int GYN=2333333;
        char SZB[GYN],*S=SZB,*T=SZB;
        inline char gc(){   if (S==T){  T=(S=SZB)+fread(SZB,1,GYN,stdin); if (S==T) return '\n';  }   return *S++;    }
    #if NEG
        inline ll read(){    ll x=0,g=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') g=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*g; }
        inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
    #else
        inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
        inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
    #endif
        inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
        inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
    	void Print(long long *a,int s,int t){For(i,s,t)printf("%lld ",a[i]);puts("");}
    	void Print(int *a,int s,int t){For(i,s,t)printf("%d ",a[i]);puts("");}
    	void Print(char *a,int s,int t){For(i,s,t)putchar(a[i]);puts("");}
    	void writeln(ll x){write(x);putchar('\n');}
    }using namespace SHENZHEBEI;
    const ll N=400010,mod=1e9+7;
    pa a[N];
    ll fac[N],Inv[N],sum[N],n,X,Y,ans=1;
    bool cmp1(pa a,pa b){return a.fi==b.fi?(a.se<b.se):(a.fi<b.fi);}
    bool cmp2(pa a,pa b){return a.se!=b.se?(a.se<b.se):(a.fi<b.fi);}
    ll ppow(ll x,ll k){ll ans=1;for(;k;k>>=1,Mul(x,x))if (k&1)Mul(ans,x);return ans;}
    ll C(ll n,ll m){return fac[n]%mod*Inv[m]%mod*Inv[n-m]%mod;}
    int main(){
    	n=read();X=read();Y=read();
    	For(i,1,n){ll x=read(),y=read();a[i]=mk(x,y);}
    	sort(a+1,a+n+1,cmp1);
    	for(ll i=1,j=0;i<=n;i=j+1){
    		j=i;
    		for(;a[j+1].fi==a[j].fi;++j);
    		For(k,i,j)if (a[k].se+a[i].se<=X)a[k].se=a[i].se;
    	}
    	sort(a+1,a+n+1,cmp2);
    	ll pos=1,first_not=1;
    	for(;(first_not<=n)&&(a[first_not].fi==a[1].fi);)++first_not;
    	if (first_not>n)return puts("1"),0;
    	pos=0;
    	For(i,1,n){
    		if (a[i].fi==a[1].fi&&a[i].se+a[first_not].se>Y)continue;
    		if (a[i].fi!=a[1].fi&&a[i].se+a[1].se>Y)continue;
    		++sum[a[i].fi];++pos;
    	}
    	fac[0]=1;For(i,1,n)fac[i]=fac[i-1]*i%mod;
    	Inv[n]=ppow(fac[n],mod-2);FOr(i,n,1)Inv[i-1]=Inv[i]*i%mod;
    	For(i,1,n)Mul(ans,Inv[sum[i]]);
    	writeln(ans*fac[pos]%mod);
    }

Measured memory_bytes: 17792