Poker
After numerous campaigns and victorious battles, the orcs have gathered a collection of trophies that the chieftain, Orgrim Doomhammer, must distribute among the warriors. He intends to do this based on their performance in battle. The chieftain instructed each orc to present 5 heads of enemy warriors they killed and arrange them in a row. All the warriors complied, and now Orgrim must evaluate each one's valor. The possible ratings are:
no pair: All the heads belong to warriors of different races, meaning there is no pair of heads from the same race.
pair: There is a pair of heads from warriors of the same race.
two pair: There are two pairs of identical heads.
set: There are three heads from warriors of the same race.
full house: Three heads from one race and two from another.
quads: Four heads from the same race.
poker: All five heads belong to warriors of the same race.
The ratings are listed in order of increasing significance, and if an orc's combination of heads fits multiple ratings, the most significant one is chosen.
Assist the chieftain by writing a program that evaluates all his warriors based on their valor.
Input
The first line of the input contains an integer T
(1 ≤ T ≤ 10000
) – the number of orcs who brought heads. Each of the following T
lines contains 5 races, separated by spaces, representing the heads laid out by the respective orc. The name of each race consists of no more than 7 lowercase Latin letters.
Output
The output should contain T
lines, each displaying the rating of the head combination for the respective orc.