a = gets.split.map(&:to_i).sort c = a.uniq.group_by{|e| a.count(e) } if c[3] && c[2] puts 'FULL HOUSE' exit 0 end if c[3] puts 'THREE CARD' exit 0 end if c[2] && 2 == c[2].size puts 'TWO PAIR' exit 0 end if c[2] puts 'ONE PAIR' exit 0 end puts 'NO HAND'