In another universe, Adam's Ark is filled with many wonderful animals, from Tralalero Tralala to Chimpanzini Bananini. To keep things organized, Adam has a log of all the data related to the ship's architectural details and any info related to the ship's occupants. Weirdly enough, this log contains a lot of ratios, and in fact only ratios! From calculating the output:input force ratio to how many hours Lirili Larila sleeps per cactus on its head, these ratios are crucial for maintaining the ship.
In the midst of his trip, a typhoon caused Adam to drop his log into the ocean! With no way to recover it, Adam realizes he is in deep trouble. He has a series of $$$q$$$ checkpoints coming up, and checkpoint $$$i$$$ will ask Adam for the $$$q_i$$$-th smallest fraction $$$\frac{a}{b}$$$ in his log. Adam doesn't have enough time to recalculate all these fractions in time for the first checkpoint. What he does remember is that his log only consisted of positive reduced fractions. More specifically, it contained every positive reduced fraction whose numerator was at most $$$n$$$ and denominator at most $$$m$$$.
Time is ticking down, so Adam has to act quickly. Can you help him answer the $$$q$$$ checkpoints and save brainrot?
The first line of input contains the numbers $$$n$$$ $$$m$$$ $$$q$$$. $$$n$$$ and $$$m$$$ ($$$1 \le n,m \le 10^4$$$) are the upper limits on the numerator and denominator respectively. $$$q$$$ is the number of checkpoints.
After this, $$$q$$$ ($$$1 \le q \le 100$$$) lines follow. If the $$$i$$$-th number is $$$q_i$$$, then checkpoint $$$i$$$ is curious about the $$$q_i$$$-th smallest fraction in Adam's log. Each query $$$q_i$$$ satisfies $$$1 \le q_i \le nm$$$.
Output $$$q$$$ lines. The $$$i$$$th line should contain the $$$q_i$$$-th smallest fraction in Adam's log in the format $$$a$$$/$$$b$$$ (if $$$b=1$$$ you should still maintain this format). If $$$q_i$$$ exceeds the number of fractions in Adam's log, print "Trick".
3 3 41693
1/3 2/1 Trick 2/3
In the sample, we have the following list of ratios in sorted order:
$$$$$$\left [ \frac{1}{3}, \frac{1}{2}, \frac{2}{3}, \frac{1}{1}, \frac{3}{2}, \frac{2}{1}, \frac{3}{1} \right ]$$$$$$