CF 80A
#include<iostream>
#include<algorithm>
using namespace std;
int prime[17]={-1,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53},n,m;
int main(){
cin>>n>>m;
if(*upper_bound(prime,prime+17,m)==n || *upper_bound(prime,prime+17,m)==n) cout<<"YES";
else cout<<"NO\n";
return 0;
}