## Power Eggs

View as PDF

Points: 15
Time limit: 2.0s
Memory limit: 16M

Problem type

Benedict bought identical power eggs from Dropeggs.com, and now he wants to test them by dropping them from different floors of his building. His building has floors numbered to . is an unknown number in the range from to , inclusive. Each egg will break if dropped from floor or above, but will not break if dropped from floor or below. Benedict can drop each egg as many times as he wants from any floor until it breaks. He wants to know the minimum number of egg drops necessary to ensure that he can determine .

For example, if there are three floors and Benedict has only one egg, then he has to first throw the egg from the first floor, then from the second floor (if the egg survived), and then from the third floor (if the egg survived). Therefore, three drops are required in the worst case.

#### Input Specification

The first line contains one number which is the number of test cases, followed by lines. Each of the next lines contains two numbers: , the number of floors and , the number of eggs .

#### Output Specification

For each of the lines, print the minimal number of drops required, or if it's greater than , print the word Impossible. After that many drops, Benedict gets too tired and cannot continue.

#### Sample Input

4
10 1
100 2
30 30
2000000000 2

#### Sample Output

10
14
5
Impossible