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