Video poker is a slot-machine variant of poker based on five-card draw. The player is dealt a hand of five cards drawn at random from a standard 52-card deck. The player may then discard any number of these cards (from 0 to 5, inclusive) and replace each discarded card with a new card drawn at random from the 47 cards that remain in the deck. The resulting five-card hand is evaluated and rewarded according to a fixed payout table. A common payout table is:
| hand | payout |
|---|---|
| one pair | 1 |
| two pair | 2 |
| three of a kind | 3 |
| straight | 4 |
| flush | 5 |
| full house | 10 |
| four of a kind | 25 |
| straight flush | 100 |
| royal flush | 250 |
Any hand that does not match a row of the table (a plain high-card hand) pays $0$. Knowing the payout table, for a given starting hand you decide which cards to discard so as to maximize the expected reward. Your task is to compute this maximal expected reward.
Standard poker hand rankings apply. A card is written as a two-character token Xs, where X is the rank (2-9, T, J, Q, K, A) and s is the suit (c, d, h, s). An ace ranks high, except that it may also be the lowest card of the straight A 2 3 4 5. A royal flush is the straight flush T J Q K A in one suit.
The first line contains one positive integer: the number of test cases (at most $100$). Each test case is given as follows:
For each starting hand, print on its own line the maximal expected reward as an exact reduced fraction p/q, where $q \ge 1$ and $\gcd(p, q) = 1$; an integer value $v$ is printed as v/1.
The expected reward is always rational: once the set of kept cards is fixed, the reward is the sum of the rewards over all equally likely draws divided by the number of such draws, so the maximum over all discard choices has an exact value that is reported as the fraction p/q.