#include using namespace std; int x,y,n,dim; int main() { scanf("%d %d",&x,&y); scanf("%d",&n); while(n) { n--; scanf("%d",&dim); if(x%dim==0||y%dim==0) printf("YES\n"); else printf("NO\n"); } return 0; }