#include int main() { int N; std::cin >> N; using P = std::pair; using PP = std::pair; std::vector s; std::map mp; for (int i = 0, x, y, z; i < N; i++) { std::cin >> x >> y >> z, s.push_back({-x, {-y, -z}}), mp[s.back()] = i + 1; } std::sort(s.begin(), s.end()); std::map mp2; for (const auto& pp : s) { if (mp2.find(pp.second) == mp2.end()) { mp2[pp.second] = mp[pp]; } } std::set ans; std::set

ps; for (const auto& q : s) { const P p = {-q.second.first, -q.second.second}; auto it = ps.lower_bound(p); if (it != ps.end() and it->second >= p.second) { continue; } ans.insert(mp2[{-p.first, -p.second}]); std::vector

er; it = ps.upper_bound(p); if (it != ps.begin()) { it--; for (; it->second <= p.second; it--) { er.push_back(*it); if (it == ps.begin()) { break; } } for (const auto& e : er) { ps.erase(e); } } ps.insert(p); } for (const int i : ans) { std::cout << i << std::endl; } return 0; }