If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on.
Consider the following five hands dealt to two players:
First line contains , i.e. number of test cases. Each test case contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner.
Print Player 1 if player 1 is winning the hand. or print Player 2 is player 2 is winning the hand.
55H 5C 6S 7S KD 2C 3S 8S 8D TD5D 8C 9S JS AC 2C 5C 7D 8S QH2D 9C AS AH AC 3D 6D 7D TD QD4D 6S 9H QH QC 3D 6D 7H QD QS2H 2D 4C 4D 4S 3C 3D 3S 9S 9D