#include <iostream>                                                                                                                                                                                         
#include <cstdio>                                                                                                                                                                                           
#include <set>                                                                                                                                                                                              
using namespace std;                                                                                                                                                                                        
                                                                                                                                                                                                            
int main(){                                                                                                                                                                                                 
    int x,y;                                                                                                                                                                                                
    cin >> x >> y;                                                                                                                                                                                          
                                                                                                                                                                                                            
    if(x == y){                                                                                                                                                                                             
        cout << "Yes" << endl;                                                                                                                                                                              
        return 0;                                                                                                                                                                                           
    }                                                                                                                                                                                                       
    if(x == 2 || y == 2){                                                                                                                                                                                   
        cout << "No" << endl;                                                                                                                                                                               
        return 0;                                                                                                                                                                                           
    }                                                                                                                                                                                                       
    set<int> a{1,3,5,7,8,10,12};                                                                                                                                                                            
    set<int> b{4,6,9,11};                                                                                                                                                                                   
                                                                                                                                                                                                            
    if(a.count(x) == a.count(y)){                                                                                                                                                                           
        cout << "Yes" << endl;                                                                                                                                                                              
    }else{                                                                                                                                                                                                  
        cout << "No" << endl;                                                                                                                                                                               
    }                                                                                                                                                                                                       
                                                                                                                                                                                                            
    return 0;                                                                                                                                                                                               
} 

Measured memory_bytes: 256