eolymp
bolt
Try our new interface for solving problems
Problems

Automatic Cash Terminal

Automatic Cash Terminal

\includegraphics{https://static.e-olymp.com/content/17/17c9266e353647138c20faebe6fcdeab4a3be0a7.gif} The automatic teller machine (ATM) has a lot of banknotes of two different values. When a person who uses the terminal requests some amount, the machine issues exactly this amount of money (of course, if this amount does not exceed a balance of the user’s account). Most people do not like to carry a huge bundle of banknotes, therefore the machine must issue requested amount using minimal possible number of banknotes. Your task is to write a program that determines the number of banknotes of each value that should be issued by the machine so that the user receives the requested amount and the total number of banknotes is minimal. You may assume that the number of banknotes of each value is not limited. \InputFile The first number in the input gives the number of test cases. A single line for each case contains three integers \textbf{a}, \textbf{b} (the values of banknotes in the machine) and \textbf{S} (the amount of money requested by the user). (\textbf{1} ≤ \textbf{a}\textit{,} \textbf{b}\textit{ }≤ \textbf{10000}, \textbf{a} ≠ \textbf{b}, \textbf{0} ≤ \textbf{S}\textit{ }≤ \textbf{10^9}). Integers in each line are separated by a space. \OutputFile For each test case print a single line in the output with two integers -- numbers of banknotes of each value which must be issued by ATM. In case when it’s not possible to issue requested amount, print the word "\textbf{Impossible}" (without quotes).
Time limit 1 second
Memory limit 64 MiB
Input example #1
1
1 10 23
Output example #1
3 2
Source All-Ukrainian Collegiate Programming Contest Semi-Final 2010