#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#define ll long long
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 10000+5;
struct Node
{
int x, y, id;
}rat[N];
int dp[N];
int pre[N];
int cmp(Node n1,Node n2)//速度从大到小,体重从小到大
{
if(n1.y==n2.y)
return n1.x < n2.x;
return n1.y>n2.y;
}
int main()
{
int n=1;
while(~scanf("%d%d",&rat[n].x,&rat[n].y))
{
rat[n].id=n;
n++;
}
sort(rat+1,rat+1+n,cmp);
memset(dp,inf,sizeof(dp));
int len = 0;
for(int i=1;i<=n;i++){
int pos=lower_bound(dp+1,dp+1+n,rat[i].x)-dp;
dp[pos]=rat[i].x;
pre[i]=pos;
len = max(len, pos);
}
printf("%d\n", len);
int ans[N];
int cnt=0;
for(int i=n-1;i>=1;i--){
if(pre[i]==len){
ans[cnt++]=rat[i].id;
len--;
}
}
for(int i=cnt-1;i>=0;i--)
printf("%d\n",ans[i]);
}