#include<iostream>
using namespace std;

int main(void){
  
 	int x, y; cin >> x >> y;
  	int a[] = {1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
  	cout << ( a[x-1] == a[y-1] ? "Yes":"No") << endl;
  
  	return 0;
}