import io.StdIn.readLine
object Main extends App {
  val groupOf = Seq('A', 'C', 'A', 'B', 'A', 'B', 'A', 'A', 'B', 'A', 'B', 'A')
  val Array(x, y) = readLine.split(" ").map(_.toInt - 1)
  println(if (groupOf(x) == groupOf(y)) "Yes" else "No")
}
