A = list(map(int, input().split())) A.sort() count2 = 0 for i in range(4): if A[i] == A[i + 1]: count2 += 1 count3 = 0 for i in range(3): if A[i] == A[i + 1] == A[i + 2]: count3 += 1 if count3 == 1 and count2 == 3: print("FULL HOUSE") elif count3 == 1 and count2 == 2: print("THREE PAIR") elif count3 == 0 and count2 == 2: print("TWO PAIR") elif count3 == 0 and count2 == 1: print("ONE PAIR") else: print("NO HAND")