Hide

Problem E
Carousel Rides

/problems/carousel/file/statement/en/img-0001.jpg
/problems/carousel/file/statement/en/img-0002.png
Carl likes to ride the carousel. Carousel operators often offer discounts for buying multiple rides. He wonders which of the discounts provides the best value. Write a program to help him.

Input

The input will contain multiple test cases, up to $100$. A test case starts with a line containing two integers $n$ ($1 \le n \le 10$) and $m$ ($1 \le m \le 20$). Carl will not take advantage of offers that require him to buy more than $m$ tickets. Following this are $n$ lines, each with integers $a$ and $b$ which each represent an offer to buy $a$ tickets for $\$ b$.

The input will be terminated by a line containing the characters 0 0.

Output

For each test case, print Buy a tickets for $b for the best offer that matches his requirements. If there are multiple best offers, print the one which buys more tickets. If there is no suitable offer, print No suitable tickets offered.

Sample Input 1 Sample Output 1
3 5
1 3
3 5
4 7
3 2
3 5
1 3
4 7
3 2
3 6
1 2
2 4
1 3
4 10
0 0
Buy 3 tickets for $5
Buy 1 tickets for $3
Buy 2 tickets for $4
No suitable tickets offered

Please log in to submit a solution to this problem

Log in