Under construction

Still being built. Things may change

Poker Card Combinations

Interview

Time limit1sMemory limit512 MB

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

Easy3 of 10

Topics
Hash map, Implementation, Simulation
Solved
No attempts yet

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.

  • 1≤T≤251 \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.

Examples6

  1. Example 1

    Input
    5
    4 3 4 3 12 10
    5 4 2 3 6 12
    10 12 10 12 12 8
    8 5 8 8 5 5
    2 10 6 10 10 10
    
    Expected output
    two pairs
    single
    full house
    two triples
    tiki
    
  2. Example 2

    Input
    9
    2 5 7 10 9 8
    4 4 7 10 8 9
    8 8 3 3 6 7
    8 8 3 3 7 7
    2 2 2 7 5 6
    2 2 2 7 7 7
    5 5 5 5 9 8
    5 5 5 5 9 9
    3 3 3 9 9 7
    
    Expected output
    single
    one pair
    two pairs
    three pairs
    one triple
    two triples
    tiki
    tiki pair
    full house
    
  3. Example 3

    Input
    1
    1 2 3 4 5 6
    
    Expected output
    single
    
  4. Example 4

    Input
    1
    13 13 13 13 1 1
    
    Expected output
    tiki pair
    
  5. Example 5

    Input
    4
    1 1 1 1 13 12
    13 13 13 1 1 1
    1 1 13 13 7 7
    13 1 13 1 13 1
    
    Expected output
    tiki
    two triples
    three pairs
    two triples
    
  6. Example 6

    Input
    4
    3 3 3 7 9 9
    9 5 5 5 9 5
    2 7 7 2 7 2
    7 9 4 10 4 8
    
    Expected output
    full house
    tiki pair
    two triples
    one pair