Poker Card Combinations

Given six card ranks, count how often each rank appears and print which of the nine named poker combinations the hand forms.

Easy3Hash mapImplementationSimulationInterviewNo attempts yetTime limit1sMemory limit512 MB

Problem

Poker is a card game that has been played in many forms since the 18th century. A standard poker deck has 52 cards split into four suits, and each suit holds 13 ranks. In Chinese speaking regions, Big Two and Thirteen Cards are two well known poker games that compare the ranking of card combinations. Writing such a game as a program requires code that recognizes a combination of cards.

The task here is a simplified version. Suits are ignored and only ranks matter. Given six cards, decide which combination they form. When ranks are written as integers, nine combinations are possible.

  • single: all six numbers differ, for example 2 5 7 10 9 8.
  • one pair: one pair of equal numbers, and the other four numbers all differ, for example 4 4 7 10 8 9.
  • two pairs: two pairs of equal numbers, and the remaining two numbers differ from each other, for example 8 8 3 3 6 7.
  • three pairs: three pairs of equal numbers, for example 8 8 3 3 7 7.
  • one triple: three equal numbers, and the other three numbers all differ, for example 2 2 2 7 5 6.
  • two triples: two groups of three equal numbers, for example 2 2 2 7 7 7.
  • tiki: four equal numbers, and the remaining two numbers differ from each other, for example 5 5 5 5 9 8.
  • tiki pair: four equal numbers plus one pair, for example 5 5 5 5 9 9.
  • full house: three equal numbers plus one pair, for example 3 3 3 9 9 7.

Ranks are integers from 1 to 13. The nine combinations do not overlap, so any six cards that satisfy the constraints belong to exactly one of them. Write a program that reads six numbers and reports the combination.

Input

The first line contains the number of test cases TT. Each of the following TT lines contains six integers separated by a single space.

  • 1T251 \le T \le 25
  • Every integer is between 1 and 13.
  • Within one test case, a number appears at most four times.

Output

For each test case, print the name of the card combination on its own line, in input order. The name is one of single, one pair, two pairs, three pairs, one triple, two triples, tiki, tiki pair, full house, written in lowercase exactly as listed.