#include <iostream>
#include <limits.h>
#include <cmath>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <stack>
#include <map>
#include <fstream>


using namespace std;


int main()
{
    int a,b,n,x,i;

    cin>>a>>b>>n;
    for(i=1; i<=n; i++)
    {
        cin>>x;
        bool ok = false;
        if (b%x==0 and (a-2)%x==0) ok = true;
        if ( a%x==0 and (b-2)%x ==0) ok = true;
        if ( (a*b)%x!=0 and a==b) ok = true;
        if (ok==true) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;

    }


    return 0;
}