What few people know is that Inaho is a fan of eggnog. He's also a fan of sales. It stands to reason, therefore, that the last time eggnog was on sale Inaho stockpiled dozens of cartons of eggnog. With the holiday season drawing to a close, he's found himself left with many a carton of eggnog nearing its expiration date. Since Inaho doesn't like expired eggnog, he's decided to serve the eggnog at the New Year's party he'll soon be attending.
Inaho has a large assortment of eggnog, but he's lacking in one area: he does not have any graded container or any means to determine volume. Specifically, every person who wants eggnog wants exactly
He has two cups with which to handle eggnog in,
Inaho can perform 3 operations:
fill I
- Inaho fills cup up to the brim with eggnog. He has so much eggnog on hand that he can do this an infinite number of times.pour I J
- Inaho pours the contents of cup into cup . Any leftover remains in cup .chug I
- With all his festive spirit Inaho downs cup , completely emptying it.
Knowing this, he can perform any number of operations on the containers with the goal of making one contain
Since he knows that there will be many people at the party, he'd like to streamline the serving process by knowing exactly which operations he'll perform for a given
Input Specification
The first and only line of input will contain 3 space-separated integers:
Output Specification
The list of operations Inaho should perform, with each item on a new line. There may be multiple shortest operation lists, and outputting any is acceptable. If it is impossible to get Not possible
.
Sample Input 1
100 1000 200
Sample Output 1
fill A
pour A B
fill A
pour A B
Sample Input 2
300 500 400
Sample Output 2
fill B
pour B A
chug A
pour B A
fill B
pour B A
Sample Input 3
100 200 500
Sample Output 3
Not possible
Comments
Ah yes, I too would want to drink an entire litre of eggnog.
Will A be always less than B?
no
msa789 thought this question was called 'eggroll'
I guess it could've been, but I like eggnog more.
Are you the real Inaho?