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