#include#define pb push_back#define _for(i,a,b) for(int i = (a);i < (b);i ++)#define INF 0x3f3f3f3f#define sz size()using namespace std;const int maxn = 50003;typedef long long ll;struct Mouse{ int w; int s; int in; bool operator < (Mouse b) { if(w!=b.w) return w < b.w; return s > b.s; }};int main(){ Mouse a[1003]; int aend = 0; int c,d; while(~scanf("%d %d",&c,&d)) { a[aend].w = c; a[aend].in = aend+1; a[aend++].s = d; } sort(a,a+aend); int dp[aend]; _for(i,0,aend) dp[i] = 1; for(int i = 1;i < aend;i ++) for(int j = 0;j < i;j ++) { if(a[i].w==a[j].w) continue; if(a[i].s < a[j].s) dp[i] = max(dp[i],dp[j]+1); } vector rrnt; int ii; int rr = 0; for(int i = aend-1;i >= 0;i --) if(rr < dp[i]) { ii = i; rr = dp[i]; } cout << dp[ii] << endl; int rnt = dp[ii]; rrnt.pb(a[ii].in); for(int i = ii-1;i >= 0;i --) if(dp[i]==rnt-1) { rnt --; rrnt.pb(a[i].in); } for(int i = rrnt.size()-1;i >= 0;i --) cout << rrnt[i] << endl; return 0;}