import scala.io.StdIn._
 
object Main {
  def main(args: Array[String]): Unit = {
    println(
      confirm(
        isHaiku(Helper.readToListInts)
      )
    )
  }
 
  def isHaiku(list: List[Int]) : Boolean =
    list.count(n => n == 5) == 2 && list.count(n => n == 7) == 1
 
  def confirm(isHaiku: Boolean): String = if (isHaiku) "YES" else "NO"
}
 
 
 
object Helper {
  def readToListInts: List[Int] = readLine.split(" ").map(_.toInt).toList
  def readToVectorInts: Vector[Int] = readLine.split(" ").map(_.toInt).toVector
}