#include<iostream> #include<memory.h> using namespace std; int a[105],b[105],c[105],d[105]; int main() { int n,i,timestart=0,j,temp,t,t1,k; memset(d,0,sizeof(d)); cin>>n; for(i=1;i<=n;i++) { cin>>a[i]>>b[i]; c[i]=i; } for(i=1;i<=n-1;i++) for(j=i+1;j<=n;j++) if(b[j]<b[i]) { temp=b[i]; b[i]=b[j]; b[j]=temp; t=a[i]; a[i]=a[j]; a[j]=t; t1=c[i]; c[i]=c[j]; c[j]=t1; } int sum=0; k=0; for(i=1;i<=n;i++) { if(a[i]>=timestart) { timestart=b[i]; d[k]=c[i]; sum++; k++; } } for(k=0;k<sum;k++) { if(k==sum-1) cout<<d[k]<<endl; else cout<<d[k]<<","; } return 0; }