#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef long long ll;
typedef unsigned long long ull;

bool can(int X, int Y, int t) {
	if(X % t == 0 && (Y - 2) % t == 0)
		return true;

	if(X % t == 0 && (Y - 1) % t == 0 && (X - 2) % t == 0)
		return true;

	if((X - 1) % t == 0 && (Y - 1) % t == 0)
		return true;

	if(Y % t == 0 && (X - 2) % t == 0)
		return true;

	if(Y % t == 0 && (X - 1) % t == 0 && (Y - 2) % t == 0)
		return true;

	return false;
}

int main () {
	//freopen("input.txt", "rt", stdin);
	int a, b;

	scanf("%d %d", &a, &b);
	int n;
	scanf("%d", &n);

	while(n--) {
		int t;
		scanf("%d", &t);
		if(can(a, b, t))
			cout << "YES\n";
		else
			cout << "NO\n";
	}	
	return 0;
}