import system, algorithm, tables, sets, lists, deques, intsets, critbits, sequtils, strutils, future proc `?`[T](tf:bool,p:proc(r:bool):T):T = p(tf) proc `|`[T](lhs,rhs:T):proc = (proc(r:bool):T = (if r: lhs else: rhs)) proc numin():auto = readLine(stdin).split().map(parseInt) proc strin():auto = readLine(stdin).split() proc sort[T](a: openArray[T], order:SortOrder=Ascending):seq[T] = sorted(a, system.cmp, order) proc group[T](v:seq[T]):seq[ref seq[T]] = var list = newSeq[ref seq[T]](0) var st = 0 for i in 0..v.len-1: if v[i] != v[i+1]: var sec = new(seq[T]) sec[] = v[st..i] list.add(sec) st = i+1 return list proc has[T](v:seq[T], vx:varargs[T]):bool= var bv:seq[T] = v for x in vx: let itr = bv.find(x) if itr == -1: return false else: bv.del(itr) return true var cv = numin().sort().group().map(x => x[].len).sort().reversed() if cv.has(3,2): echo "FULL HOUSE" elif cv.has(3): echo "THREE CARD" elif cv.has(2,2): echo "TWO PAIR" elif cv.has(2): echo "ONE PAIR" else: echo "NO HAND"