#include using namespace std; int main() { int a,b,x,n,i; cin>>a>>b>>n; for(i=1; i<=n; i++) { cin>>x; if(a%x>2||b%x>2) cout<<"NO"<<"\n"; else if(x==1) cout<<"YES"<<"\n"; else if(a==b) { if(a%x==2) { if(b%x==0) cout<<"YES"<<"\n"; } else if(b%x==2) { if(a%x==0) cout<<"YES"<<"\n"; } else if(a%x==1&&b%x==1) cout<<"YES"<<"\n"; } else if(a%x==2) { if(b%x==0) cout<<"YES"<<"\n"; } else if(b%x==2) { if(a%x==0) cout<<"YES"<<"\n"; } else cout<<"NO"<<"\n"; } return 0; }