#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=5012;
struct node
{
int wi,hi,id;
}p[maxn];
int n,w,h,ans,path[maxn];
int cmp(node a,node b)
{
if(a.wi!=b.wi)return a.wi<b.wi;
return a.hi<=b.hi;
}
int dp[maxn];
void dfs(int key)
{
if(path[key]==-1)
{
//cout<<"OK ";
cout<<p[key].id<<" ";return;
}
dfs(path[key]);
cout<<p[key].id<<" ";
}
int main()
{
while(scanf("%d%d%d",&n,&w,&h)!=EOF)
{
int i,j,key=0;
ans=0;
memset(path,-1,sizeof(path));
for(i=1;i<=n;i++)
{
scanf("%d%d",&p[i].wi,&p[i].hi);
p[i].id=i;
dp[i]=0;
}
sort(p+1,p+n+1,cmp);
for(i=1;i<=n;i++)
{
if(p[i].wi>w&&p[i].hi>h)
{
dp[i]=1,path[i]=-1;
if(!ans) ans=dp[i],key=i;
}
for(j=i-1;j>=1;j--)
{
if(dp[j]&&p[j].wi<p[i].wi&&p[j].hi<p[i].hi)
{
if(dp[i]<dp[j]+1)
{
dp[i]=dp[j]+1;
path[i]=j;
if(ans<dp[i])ans=dp[i],key=i;
}
}
}
}
cout<<ans<<endl;
if(ans)
{
dfs(key);cout<<endl;
}
}
return 0;
}
/*
5 10 10
22 23
17 19
13 17
8 12
2 6
3 3 3
5 4
12 11
9 8
2 1 1
2 2
2 2
4 12 140
172 60
71 95
125 149
53 82
*/