import java.util.*; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); //与えられるカード int[] A = new int[5]; for(int i = 0; i < A.length; i++) { A[i] = sc.nextInt(); } //カードを昇順に並び替える Arrays.sort(A); //フルハウス判定 boolean three = false; //スリーカード判定 boolean pair = false; //ペア判定 boolean twoPair = false; //ツーペア判定 String ans; //先頭から順に同じカードの数を数える for(int i = 0; i < A.length - 1; i++) { int cnt = 1; for(int j = i + 1; j < A.length; j++) { if(A[i] == A[j]) { cnt++; } else { i = j - 1; break; } } //スリーカード判定 if(cnt >= 4) { break; } else if(cnt == 3) { three = true; //ペア判定 } else if(cnt == 2 && !pair){ pair = true; //ツーペア判定 } else if(cnt == 2 && pair) { twoPair = true; } } //役判定 if(three && pair) { ans = "FULL HOUSE"; } else if(three) { ans = "THREE CARD"; } else if(twoPair) { ans = "TWO PAIR"; } else if(pair) { ans = "ONE PAIR"; } else { ans = "NO HAND"; } System.out.println(ans); } }