import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); String[] cards = sc.nextLine().split(" "); Set cardSpecies = new HashSet<>(Arrays.asList(cards)); int pair = 0, triple = 0; for(String s : cardSpecies){ switch (count(s, cards)){ case 2 -> pair++; case 3 -> triple++; } } if(triple == 1){ switch (pair){ case 0 -> System.out.println("THREE CARD"); case 1 -> System.out.println("FULL HOUSE"); } System.exit(0); } switch (pair){ case 0 -> System.out.println("NO HAND"); case 1 -> System.out.println("ONE PAIR"); case 2 -> System.out.println("TWO PAIR"); } } public static int count(String s , String[] cards){ int count = 0; for(String c : cards){ if(c.equals(s)){ count++; } } return count; } }