#include #include #include #include #include #include #include #include #include #include #include #include #include #pragma region using namespace std; #define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++) #define rep(i,n) FOR(i,0LL,n) #define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--) #define rrep(i,n) RFOR(i,0LL,n) #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x) #define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end()) #define SUM(a) accumulate(all(a),0LL) #define pb push_back #define endl '\n' typedef long long int ll; typedef vector vll; typedef vector vvll; typedef pair pll; typedef vector vpll; typedef vector vs; typedef map MAP; const ll inf = 2222222222222222222LL; const ll mod = 1000000007LL; ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf; string s; bool ok = true, flag = false; ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 }; #pragma endregion #define MAX 222222 struct RMQ { vll data; ll siz; RMQ(ll x = MAX) { siz = 1; while (siz < x) siz *= 2; data.resize(2 * siz - 1, -inf); } void update(ll k, ll a) { k += siz - 1; data[k] = a; while (k > 0) { k = (k - 1) / 2; data[k] = max(data[k * 2 + 1], data[k * 2 + 2]); } } ll query(ll a, ll b, ll k = 0, ll le = 0, ll ri = -inf) { if (ri == -inf) ri = siz; if (ri <= a || b <= le) return -inf; if (a <= le && ri <= b) return data[k]; else { ll maxl = query(a, b, k * 2 + 1, le, (le + ri) / 2); ll maxr = query(a, b, k * 2 + 2, (le + ri) / 2, ri); return max(maxl, maxr); } } }; int main(void) { cin >> n; RMQ seg(11111); vector> vec; pair p; map, ll> mp; vll an; rep(i, n) { cin >> p.first >> p.second.first >> p.second.second; vec.pb(p); mp[p] = i + 1; } sort(rall(vec)); rep(i, n) { if (vec[i].second.second >= seg.query(vec[i].second.first, 11111)) an.pb(mp[vec[i]]); if (vec[i].second.second > seg.query(vec[i].second.first, vec[i].second.first + 1)) { seg.update(vec[i].second.first, vec[i].second.second); } } sort(all(an)); rep(i, an.size()) cout << an[i] << endl; return 0; }