#include using namespace std; using P = pair; const int M = 1000000007; class max_segtree { private: int n, s, t; vector tr; const int ex = -1; int q(int k, int l, int r) { return r <= s || t <= l ? ex : s <= l && r <= t ? tr[k] : max(q(k << 1 | 1, l, (l + r) >> 1), q((k + 1) << 1, (l + r) >> 1, r)); } public: max_segtree(int m) { n = 1; while (n < m) n <<= 1; tr.clear(); tr.resize((n << 1) - 1, ex); } void update(int j, const int& x) { int i = j + n - 1; tr[i] = x; while (i > 0) { i = (i - 1) >> 1; tr[i] = max(tr[i << 1 | 1], tr[(i + 1) << 1]); } } int look(int j) { return tr[j + n - 1]; } // [s, t) int run(int _s, int _t) { s = _s; t = _t; return q(0, 0, n); } }; int main() { int n; cin >> n; vector>> a(n); for (int i = 0; i < n; ++i) { cin >> a[i].first >> a[i].second.first.first >> a[i].second.first.second; a[i].second.second = i; } sort(a.begin(), a.end()); reverse(a.begin(), a.end()); max_segtree sg(10010); vector ans(n, true); for (auto& i : a) { P& p = i.second.first; if (sg.run(p.first, 10010) >= p.second) ans[i.second.second] = false; if (sg.look(p.first) < p.second) sg.update(p.first, p.second); } for (int i = 0; i < n; ++i) if (ans[i]) cout << i + 1 << "\n"; return 0; }