main = do
  list <- map read.words<$>getLine
  if canHaiku list
     then putStrLn "YES"
     else putStrLn "NO"

isFive 5 = True
isFive _ = False

isSeven 7 = True
isSeven _ = False

canHaiku = lengthCheck [] [isFive,isFive,isSeven]

lengthCheck gs fs [] = True
lengthCheck _ [] _ = False
lengthCheck gs (f:fs) (x:xs)
  | f x = lengthCheck [] (gs++fs) xs
  | otherwise = lengthCheck (f:gs) fs (x:xs)
