#include <bits/stdc++.h>

#define int long long
#define fs first
#define sc second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define len(v) ((int)v.size())
#define vc vector
#define pr pair
#define endl "\n"
#define endd "\n"; return 0;
#define all(v) v.begin(), v.end()

/**********.*****.**************************:-******-:*******************
**********......:*****************+@%@*+#@@@+.****.***********************
...------........-*+*********+%#####@@@##########*************************
********:........----------%@#####################@@-...............------
**********......:********@%#####@###################@#@=+***************::
*********.:****--******%##@#####@#######################@*+***************
********.*******:-**+@@####@#@@@#################@#########=**************
*******-*********:*@@@######@###############################=*************
*****--**********%%@##@########@#############################=:***********
****.************+##################@#@@#####################@************
***.*************%######################@@###################=***********-
*-:**************=##########@@%%%%=%@=%=%=%@################@@**********.*
.****************########%++***+++****+++=+===+++***+=%@######%*******:-**
****************+#######%+*::::::::::::***********:::::**@@###%******.:***
****************#######@%*:::::::::::::::*:*****:::::::::*@@##@*****.*****
****************######@%+*:::::::-::::::::::::::::::::::::=@##%****-******
.......-------:*######=::::::----------:::::::::::::::::::+###:**--*******
............:==:%####=:::::----:-:::::::::::::::::::::::::=@##:-.:********
************=@++*%##@::::*=%%%@@###@=***::::::::::::::::::=@#@*..*********
************=**+@+@#*:::**+++%@#@###%@%%+*::*+=======*::::*##-:**.********
*************:=%%:%*::::*+=%##%###=@@@%=*::*=%@@@%%@@#@%::+#@:****.*******
:**************==:=:::--::::*++++=%@@@%*:--*%#@####@#=+***@@%@*****.******
--**************:-*::--------::**+***:::---*+%%%%%%@@%+*::#*@%******.*****
*:-************---*::::-----------::--:---::::+++++**:::::%*%********-:***
**:.************++*:::::--------::**+------::::::::::::::*++**********--**
****.**************::::::-----::**==:-------+*:::::---:::**************:-*
*****.***********.*::::::::-:::***:*+@**::**=+*::::::::::****************-
******.*:*%@######+::::::::::::::::::++++=******::::::::******************
******:############*::::::::****::::::*+*:*:*:***::::::*******************
******#############***::*:*:*+==@@##=======:*+***:::*:********************
******#############:*+**********:*++**+**++=%=***:*::*********************
.....##############::*++**************+***:*********###+******************
***:##############@*:**+=***:::**++===++***********#####%.................
*:*###############******++=+*:::::::*:::::*::***#########=****************
**:################%*****++==++********::::*+++=##########+***************
*:%##################******++++==+=++++++++++++@############**************
######################@******+++++++++++++++++=%#############*************
########################+++++++++++++++++++++==@#############@***********.
#########################%+++++++++++++++++===%###############%********:-*
########################@=#=++++++++++++====%@##################******-**/

using namespace std;

const int MAXN = 1e5;
const int INF = 1e18;
const int MOD = 1e9 + 7;

main() {
    ios_base::sync_with_stdio(0);
    int a, b;
    int tek;
    {
        cin >> a;
        if (a == 1) {
            tek = 1;
        }
        if (a == 3) {
            tek = 1;
        }
        if (a == 5) {
            tek = 1;
        }
        if (a == 7) {
            tek = 1;
        }
        if (a == 8) {
            tek = 1;
        }
        if (a == 10) {
            tek = 1;
        }
        if (a == 12) {
            tek = 1;
        }
        if (a == 4) {
            tek = 2;
        }
        if (a == 6) {
            tek = 2;
        }
        if (a == 9) {
            tek = 2;
        }
        if (a == 11) {
            tek = 2;
        }
        if (a == 2) {
            tek = 0;
        }
    }
    int tek1 = tek;
    {
        cin >> a;
        if (a == 1) {
            tek = 1;
        }
        if (a == 3) {
            tek = 1;
        }
        if (a == 5) {
            tek = 1;
        }
        if (a == 7) {
            tek = 1;
        }
        if (a == 8) {
            tek = 1;
        }
        if (a == 10) {
            tek = 1;
        }
        if (a == 12) {
            tek = 1;
        }
        if (a == 4) {
            tek = 2;
        }
        if (a == 6) {
            tek = 2;
        }
        if (a == 9) {
            tek = 2;
        }
        if (a == 11) {
            tek = 2;
        }
        if (a == 2) {
            tek = 0;
        }
    }
    if (tek == tek1){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}


Measured memory_bytes: 256