import java.util.*; public class Exercise71{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int[] cards = new int[5]; int[] pairs = new int[5]; for(int i = 0; i < 5; i++){ cards[i] = sc.nextInt(); } for(int i = 0; i < 5; i++){ int count = 0; for(int j = 0; j < 5; j++){ if(cards[i] == cards[j]){ count++; } } pairs[i] = count; } Arrays.sort(pairs); int[] fullhouse = new int[]{2, 2, 3, 3, 3}; int[] threecard = {1, 1, 3, 3, 3}; int[] twopair = {1, 2, 2, 2, 2}; int[] onepair = {1, 1, 1, 2, 2}; if(Arrays.equals(pairs, fullhouse)){ System.out.println("FULL HOUSE"); }else if(Arrays.equals(pairs, threecard)){ System.out.println("THREE CARD"); }else if(Arrays.equals(pairs, twopair)){ System.out.println("TWO PAIR"); }else if(Arrays.equals(pairs, onepair)){ System.out.println("ONE PAIR"); }else{ System.out.println("NO HAND"); } } }