Byteasar has just begun his PhD. He both researches and teaches, and the first semester is over: his students have taken their exam, and now he has to grade it.
Each student handed in one sheet of paper of size A×B millimetres. Following an old departmental tradition, Byteasar gathered every sheet, tossed them all into the air, and let them fall to the floor. To his surprise, each sheet landed with its sides parallel to the walls of his rectangular office. The students whose sheets end up on top pass the exam.
A sheet is on top if none of its interior points is covered by another sheet. In particular, the sides (the boundary) of a sheet may be covered without disqualifying it.
Determine which students passed the exam.
The first line contains three integers n, A, and B (1≤n≤100,000, 1≤A,B≤109): the number of sheets and the dimensions of each sheet in millimetres. Every sheet is a rectangle with sides parallel to the axes.
The next n lines describe the sheets in the order they fell to the floor. Each sheet is given by three integers xi, yi, ri (−109≤xi,yi≤109, ri∈{0,1}). The point (xi,yi) is the lower-left corner of the sheet. If ri=0 the sheet has height A and width B; if ri=1 the sheet has height B and width A.
Wherever two sheets overlap, the one that fell later lies on top.
On the first line print one integer k: the number of sheets whose interior is not covered by any other sheet. On the second line print, in increasing order, the indices of those sheets. Sheets are numbered 1 through n in the order they appear in the input.