#include <bits/stdc++.h>
using namespace std;

int main(){
  int X[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
  int A,B;
  cin >> A >> B;
  if(X[A] == X[B]){
    cout << "Yes" << endl;
  }
else{
cout << "No" << endl;
}
}
