402578: GYM100812 E World of Knights

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

Description

E. World of Knightstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

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.

Input

The 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.

Output

In 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.

ExamplesInput
6
1 1
0 2
2 4
2 5
4 5
5 10
Output
3
2 4 6
Input
5
1 6
1 7
2 4
6 7
7 0
Output
2
2 5
Input
1
2 0
Output
No such luck

加入题单

算法标签: