#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i ) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair pint; typedef pair pli; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; struct SegmentTree{ private: int n; vector node; public: SegmentTree(int sz,ll init){ n=1; while(n0){ k=(k-1)/2; node[k]=max(node[2*k+1],node[2*k+2]); } } //[a,b)でのminを返す ll get(int a,int b,int k=0,int l=0,int r=-1){ if(r<0)r=n; if(r<=a||b<=l)return -1; if(a<=l&&r<=b)return node[k]; ll xl=get(a,b,2*k+1,l,(l+r)/2); ll xr=get(a,b,2*k+2,(l+r)/2,r); return max(xl,xr); } }; using P = pair ; int main(){ int n; cin>>n; P p[n]; rep(i,n){ int a,b,c; cin>>a>>b>>c; p[i]={{a,b},{c,i+1}}; } sort(p,p+n); reverse(p,p+n); SegmentTree sg(12345,-1); vector ans; rep(i,n){ int ret=sg.get(p[i].first.second,12345); if(ret>=p[i].second.first)continue; ans.push_back(p[i].second.second); sg.update(p[i].first.second,p[i].second.first); } sort(ans.begin(),ans.end()); for(auto e:ans){ printf("%d\n",e); } return 0; }