import io.{StdIn => in}

object Main extends App {
  val arr = Array.ofDim[Int](8)
  in.readLine.split(" ").map(_.toInt).foreach(i => arr(i) += 1)
  val ans = if(arr(5) == 2 & arr(7) == 1) "YES" else "NO"

  println(ans)
}
