402578: GYM100812 E World of Knights
Description
I woke up tied to an iron chair in a wet basement lighted by a single dying candle. The headache was just like after the graduation party in the knight school, and the bitter of the Princess' poison still remained on my lips. A black thug in a leather armor sat at a metal table in front of me. An ugly grimace on his face was to portray a mockery. He was professionally shuffling a deck of cards. That's what happens if you ask too many questions about Dragon.
I instantly recognized my only companion. It was Black Knight — an assassin, known by offering his victims to play cards against him, promising to release in case of a win. Nobody had managed to beat him so far, but I felt luck was on my side that day.
We played «World of Knights» — a card game popular among farmers and swineherds. Each card in the game had two integer characteristics — cost and resource. I had a card with cost 0 and resource 1 in my hand. Not the best one. On the table in front of me there were n cards, the i-th of which had cost ci and resource ri. Every turn I could exchange a card in my hand with a card from the table whose cost was not greater than the resource of the card in the hand. I needed the n-th card. I felt that if I'd got it, I would have won for sure. I decided to get it in a minimal number of turns, ignoring actions of my opponent, especially since I didn't know any other rules of the game.
InputThe first line contains a single integer n (1 ≤ n ≤ 105) — the number of cards on the table.
Each of the next n lines contains two integers separated by a space: ci and ri (0 ≤ ci, ri ≤ 109) — cost and resource of the i-th card on the table.
OutputIn the first line output a single integer k — the minimal number of turns to get the n-th card into the hand.
In the second line output k integers separated by spaces — the numbers of cards to exchange with at each turn. The cards are numbered from 1.
If there are several possible answers, output any of them. If it's impossible to get the n-th card in any number of turns, output «No such luck» without quotes.
ExamplesInput6Output
1 1
0 2
2 4
2 5
4 5
5 10
3Input
2 4 6
5Output
1 6
1 7
2 4
6 7
7 0
2Input
2 5
1Output
2 0
No such luck