function Main(input) {
  input = input.trim()
  input = input.split(" ");
  if(hoge(input[1])==hoge(input[0])){
  console.log("Yes")
  }else{
  console.log("No")
  }
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
function hoge(n){
if(n==1||n==3|n==5||n==7||n==8||n==10||n==12) return 1;
  else if(n==2) return 3;
  else return 2;
}
