400779: GYM100247 A The Power of the Dark Side

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. The Power of the Dark Sidetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

On the Jedi Tournament n Jedi are battling each other. Every Jedi has three parameters: strength, agility and intelligence. All parameters of all Jedi are different. When two Jedi have a fight, the winner will be the Jedi which has more parameters higher compared to the same parameters of his opponent. For example, Jedi with parameters (5, 9, 10) defeats Jedi with parameters (2, 12, 4) because of first and third parameters.

Sith have a plan to turn one the Jedi to the dark side of the Force. It will give him a powerful skill that allows to swap some his parameters, maybe more than one time, before every fight. Sith wish their new apprentice to defeat all of the remaining Jedi.

Which Jedi can be used by Sith to lead their plan to success?

Input

The first line contains the only integer n (1 ≤ n ≤ 200000) — the number of the Jedi.

Then n lines follow. Each of them contains three integers separated by space: ai, bi and ci (1 ≤ ai, bi, ci ≤ 109) — the parameters of the Jedi.

All ai, bi and ci are pairwise distinct.

Output

In the first line output one integer m — the number of the suitable Jedi.

In the second line output m integers — the numbers of these Jedi — in the ascending order.

ExamplesInput
4
5 9 10
2 12 4
8 7 3
6 11 1
Output
2
1 4
Input
4
4 1 11
5 8 9
2 12 6
7 3 10
Output
3
2 3 4

加入题单

上一题 下一题 算法标签: