Exam

No attempts yetTime limit5sMemory limit128 MB

Problem

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×BA \times 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.

Input

The first line contains three integers nn, AA, and BB (1n100,0001 \le n \le 100{,}000, 1A,B1091 \le A, B \le 10^9): 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 nn lines describe the sheets in the order they fell to the floor. Each sheet is given by three integers xix_i, yiy_i, rir_i (109xi,yi109-10^9 \le x_i, y_i \le 10^9, ri{0,1}r_i \in \{0, 1\}). The point (xi,yi)(x_i, y_i) is the lower-left corner of the sheet. If ri=0r_i = 0 the sheet has height AA and width BB; if ri=1r_i = 1 the sheet has height BB and width AA.

Wherever two sheets overlap, the one that fell later lies on top.

Output

On the first line print one integer kk: 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 11 through nn in the order they appear in the input.