{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eFive desperados are playing a poker game.\u003c/p\u003e\n\u003cp\u003eThe hot dealer Myla organizes a $T$-round competition.Before the game, each player has $100$ \u003cstrong\u003epots\u003c/strong\u003e corresponding to a certain amount of money. A penniless player, whose pot is zero, will be disqualified and is not allowed to play anymore.\u003c/p\u003e\n\u003cp\u003eAs in most poker games, the deck is a standard $52$-card deck containing no jokers. Instead of a fair shuffle of the cards, Myla has decided the order of cards on ahead of time.\u003c/p\u003e\n\u003cp\u003eNow the game begins.\u003c/p\u003e\n\u003cp\u003eDuring every round, play begins with each player being dealt two private cards face down, with the first non-disqualified player receiving the first and the second cards, and the second non-disqualified player receiving the third and fourth cards, and etcetera. These cards are the players\u0027 \u003cstrong\u003ehole cards\u003c/strong\u003e.\u003c/p\u003e\n\u003cp\u003eThe hand begins with a \u003cstrong\u003epre-flop betting\u003c/strong\u003e round in which all players make decisions one by one in order.Each player may \u003cstrong\u003efold\u003c/strong\u003e, which is to drop out of the hand and give up in this round, or \u003cstrong\u003ecall\u003c/strong\u003e, which is to call for a bet of $5$ pots.\u003c/p\u003e\n\u003cp\u003eAfter the pre-flop betting round, the hot dealer Myla deals a flop: three face-up \u003cstrong\u003ecommunity cards\u003c/strong\u003e. The flop is followed by a second betting round similarly. Each player may fold, which is to drop out of the hand losing any bets they have already made, or call, which is to call for a bet of $5$ pots.\u003c/p\u003e\n\u003cp\u003eAfter the \u003cstrong\u003eflop betting\u003c/strong\u003e round ends, two more community cards are dealt, followed by a \u003cstrong\u003ethird betting\u003c/strong\u003e round as before.\u003c/p\u003e\n\u003cp\u003eIf a player wants to remain after the final betting round, he must call for $15$ pots in total. But there is one exception. If a player, before the pre-flop betting round, has less than $15$ pots, he is not allowed to take part in even the pre-flop betting round unless he declares himself \u003cstrong\u003eall in\u003c/strong\u003e in the pre-flop betting round betting his entire stack. If a player goes all-in, he does not need to bet anymore and will be remained after the final betting round no matter whether he would be willing or not.\u003c/p\u003e\n\u003cp\u003eAt any time during a round, if only one player remains and all other players have folded, the remaining player is awarded the pot and is not required to show his hole cards. If two or more players remain after the final betting round, a showdown occurs. On the showdown, each player plays the best poker hand they can make from the seven cards comprising their two-hole cards and the five community cards.\u003c/p\u003e\n\u003cp\u003eThe player who has the best hand takes all the pots called in betting rounds. If the best hand is shared by more than one player, then one in the last order takes all the pots.\u003c/p\u003e\n\u003cp\u003eFollowing list shows the possible hand values in increasing order.\u003c/p\u003e\n\u003cul\u003e\n \u003cli\u003e\u003cstrong\u003eHighcard\u003c/strong\u003e Simple value of the card.\u003c/li\u003e\n \u003cli\u003e\u003cstrong\u003ePair\u003c/strong\u003e Two cards with the same value.\u003c/li\u003e\n \u003cli\u003e\u003cstrong\u003eThree of a kind\u003c/strong\u003e Three cards with the same value.\u003c/li\u003e\n \u003cli\u003e\u003cstrong\u003eStraight\u003c/strong\u003e Sequence of $5$ cards in increasing value (Ace can only be the first card preceding $2$ or the last one following up King). All possible Straights are listed as follows: \u003ccode\u003eA2345, 23456, 34567, 45678, 56789, 6789-10, 789-10-J, 89-10-JQ, 9-10-JQK\u003c/code\u003e and \u003ccode\u003e10-JQKA\u003c/code\u003e.\u003c/li\u003e\n \u003cli\u003e\u003cstrong\u003eFlush\u003c/strong\u003e $5$ cards of the same suit.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThe card\u0027s numerical rank is also important.The card rank with highest first is given by \u003ccode\u003eA K Q J 10 9 8 7 6 5 4 3 2 (A only in the case of Straight A2345)\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eIf several players share a common hand value, the rank of the critical card higher, the hand better.In a HighCard, the critical card is the one with the highest rank. In a Pair, the critical card is the one appearing in a pair with the highest rank. If the hand is Three of a kind, the card in the triple is critical. The card with the highest rank in a Straight or a Flush is the critical card, but note that $5$ is the critical card in Straight \u003ccode\u003eA2345\u003c/code\u003e but Ace is the critical one in Straight \u003ccode\u003e10-JQKA\u003c/code\u003e. \u003cstrong\u003ePlease pay attention to this case and note that if cards in \u003ccode\u003eA2345\u003c/code\u003e are of the same suit, it should be regarded as Flush or the so-called Straight Flush, and the critical card here is the Ace.\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eNow, let\u0027s talk about these desperados. All of them were professional ACM competitors and they all know how to design a good strategy.\u003c/p\u003e\n\u003cp\u003eThe first one is John-zeng Montagu. If his pot is less than $15$, he folds in the very beginning. He calls in the pre-flop betting round only if his hole cards are of the same suit. He always calls in the flop betting round and calls in the third betting round if the best poker hand he can make is not worse than Pair.\u003c/p\u003e\n\u003cp\u003eThe second player is Brain-chen Molony. In the pre-flop betting round, he calls or even goes all-in if he has at least $15$ pots or his hole cards are the double Aces. He calls in the flop betting round if the given $5$ cards are not worse than Pair, or he can make it Straight or Flush with one more ideal card. He calls in the third betting round unless there are at least four community cards with the same suit.\u003c/p\u003e\n\u003cp\u003eThe third player is Wild-tang-Bill Hickok. He calls or even goes all-in, in the pre-flop betting round, if he holds at least one Ace or the value difference between his hole cards is less than three. In the flop betting round, he folds when two of the community cards share the same value but the value does not appear in his hole cards. He always calls in the third betting round.\u003c/p\u003e\n\u003cp\u003eThe fourth player is Kerry-wu Packer. In the pre-flop betting round, he calls or even goes all-in if he holds a card whose rank is higher than Jack (including Ace). He calls in the flop betting round if he holds a card higher than all community cards, or he can pair a hole card up with the highest community card. In the third betting round, he calls if the best hand is not worse than Three of a kind, or at least Pair and the rank (of the Pair) is higher than the rank of the third-highest community card (counted with multiplicity). \u003cstrong\u003ePlease pay more attention to his strategy.\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe last player is Archie-zou Karas. In the pre-flop betting round, he calls or even goes all-in only if there is only one another player called. Then he always calls in the second and the third round.\u003c/p\u003e\n\u003ch3\u003eInput\u003c/h3\u003e\n\u003cp\u003eThe first line contains an integer $T~(1\\le T\\le 1000)$ indicating the total number of rounds organized.\u003c/p\u003e\n\u003cp\u003eEach of the following $T$ lines contains $15$ integers describing all cards dealt by the hot dealer Myla in order. Note that the hot dealer can deal less than fifteen cards and remain some in her hand since some players may be disqualified. The numbers from $1$ to $13$, from $14$ to $26$, from $27$ to $39$ and from $40$ to $52$ correspond to cards in different suits from Ace, $2$ to $10$, Jack, Queen and King.\u003c/p\u003e\n\u003ch3\u003eOutput\u003c/h3\u003e\n\u003cp\u003eOutput five lines, each of which contains a number indicating the final pot of the corresponding player.\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n1 2 8 10 3 11 15 12 14 27 42 43 45 48 13\n14 2 8 10 3 11 5 23 1 27 42 43 13 45 48\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e90\n90\n100\n115\n105\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}},{"title":"Sample 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n26 38 46 4 52 15 51 7 1 30 5 3 33 47 34\n22 7 15 9 5 29 32 23 30 25 33 2 1 50 4\n22 44 31 33 32 39 26 5 21 15 48 2 52 37 13\n21 50 12 7 43 26 32 28 42 30 20 9 35 47 8\n38 12 4 33 10 25 50 37 46 36 6 40 29 48 5\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e100\n65\n100\n120\n115\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}},{"title":"Sample 3","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n32 51 43 23 30 17 36 37 48 22 46 41 20 1 42\n49 29 40 4 19 46 13 39 8 12 47 38 16 32 34\n37 34 45 36 10 26 33 21 46 35 39 13 41 27 19\n51 15 42 35 27 52 18 1 44 37 26 39 33 32 8\n31 50 52 24 37 17 26 2 20 13 1 38 9 49 51\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e85\n105\n110\n100\n100\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}}]}