#include<fstream>
#define InFile "Input.in"
#define OutFile "Output.out"
using namespace std;
ifstream f(InFile);
ofstream g(OutFile);
long long X,Y,A;
int N;
int main(){
     f>>X;
     f>>Y;
     f>>N;
     int i;
     for(i=1;i<=N;i++){
        f>>A;
        if((X-2)%A==0)
            g<<"YES\n";
        else
            g<<"NO\n";
     }
     f.close();
     g.close();
     return 0;
}