#include #include #include #include #define x first #define y second #define now q.front() #define P pair #include #include using namespace std; ifstream f(".in"); ofstream g(".out"); int a,b,x,y,ok; int i,j,n; int main() { cin>>x>>y; cin>>n; for(i=1;i<=n;i++) { aux=y; ok=0; cin>>a; if(x%a==0) { y-=2; if(y%a==0) cout<<"YES"; else cout<<"NO"; } else if(x%a==1) { if((y%a==0&&(y-2)%a==0)||((y-1)%a==0)) cout<<"YES"; else cout<<"NO"; } else if(x%a==2) { if(y%a==0) cout<<"YES"; else cout<<"NO"; } else cout<<"NO"; cout<<'\n'; y=aux; } return 0; }