#include <iostream>
#define nmax 1005

using namespace std;

int x, y, n, a[nmax], cut, p, dif;
bool ok;

int main()
{
    cin >> x >> y;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    for(int i=1; i<=n; i++){
      ok=false;
      if((y%a[i] == 0) && ((x-2)%a[i] == 0))
         ok=true;
      else
        if(y%a[i] == 1 && (x-1)%a[i] == 0)
            ok=true;
       if(ok)
            cout << "YES\n";
       else
            cout << "NO\n";
    }
    return 0;
}