"use strict";

const main = arg => {
    const A = [1,3,5,7,8,10,12];
    const B = [4,6,9,11];
    
    const x = parseInt(arg.split("\n")[0].split(" ")[0]);
    const y = parseInt(arg.split("\n")[0].split(" ")[1]);
    
    if(x == y) {
        console.log("Yes");
        return;
    }
    
    if(A.indexOf(x) !== -1 && A.indexOf(y) !== -1) {
        console.log("Yes");
        return;
    }
    
    if(B.indexOf(x) !== -1 && B.indexOf(y) !== -1) {
        console.log("Yes");
        return;
    }
    
    console.log("No");
    
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));