Hide

Problem B
Bottle Opening

/problems/wcfd21.bottleopening/file/statement/en/img-0001.gif

The crown cork bottle stopper, used to seal beer bottles, was the first highly successful disposable product. It was invented by William Painter in 1892 in Baltimore; the product’s disposability and success inspired King C. Gillette to invent the disposable razor when he was a salesman for the Crown Cork Company.

Crown-corked bottles are supposed to be opened with a special tool called a bottle opener. However, with some practice, you can learn how to open a crown-corked bottle using another crown-corked bottle. This process opens the first bottle but leaves the second crown-corked; the first bottle’s cork is disposed of and not used again.

Given $n$ crow-corked bottles, devise a plan to open $k$ of them with this procedure (if possible).

Input

The integer $n$ (the number of crown-corked bottles), followed by the integer $k$ (the desired number of open bottles), on separate lines. You can assume $1\leq k\leq n\leq 100$.

Output

Print “impossible” if there is no way to open $k$ of the bottles. Otherwise print exactly $k$ lines for the form “open 4 using 9”, meaning that bottle 4 is opened with bottle 9. In general, the form is “open $t$ using $b$”, where $t$ and $b$ are distinct integers from $\{ 1,\ldots , n\} $ and $b$ is not yet opened.

Explanation of sample 1

In sample $1$, there are three bottles, and you want to open one of them. This can be done, for instance using bottle $2$ to open bottle $1$. (There are other ways of doing this. Any valid answer is accepted.)

Explanation of sample 2

In sample $2$, there is one bottle. Bottles can’t be used to open themselves, so it is impossible to achieve an open bottle.

Sample Input 1 Sample Output 1
3
1
open 1 using 2
Sample Input 2 Sample Output 2
1
1
impossible

Please log in to submit a solution to this problem

Log in