import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val x = sc.nextInt
  val y = sc.nextInt

  val a = Seq(1,3,5,7,8,10,12)
  val b = Seq(4,6,9,11)
  val c = Seq(2)

  val res = if(isSameGroup(x,y)) "Yes" else "No"

  println(res)

  def isSameGroup(x: Int, y: Int): Boolean ={
    ( a.contains(x) && a.contains(y) ) ||
    ( b.contains(x) && b.contains(y) ) ||
    ( c.contains(x) && c.contains(y) )
  }

}
