  main :: IO ()
  main = do
    a <- words <$> getLine :: IO [String]
    let b = map read a :: [Int]
    if fillen 5 b == 2 && fillen 7 b == 1    
       then print "YES"
       else print "NO"
       where fillen i c = length $ filter (==i) c