object Main extends App {
    val list = readLine.split(" ").map{_.toInt}.toList
    def loop(restList: List[Int], acc: List[Int]): Unit = {
      restList match {
        case Nil => println("YES")
        case head :: tail if head == 7 => {
          if(acc.contains(7)) println("NO") else loop(tail, acc :+ head)
        }
        case head :: tail if head == 5 => {
          if(acc.count(x => x == 5) < 2 ) loop(tail, acc :+ head) else println("NO")
        }
        case _ => println("NO")
      }
    }
    loop(list, List.empty)
}