#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"); long long int a,b,x,y; int i,j,n; int main() { cin>>x>>y; cin>>n; for(i=1;i<=n;i++) { cin>>a; if(x%a==0||y%a==0) cout<<"YES"; else cout<<"NO"; cout<<'\n'; } return 0; }