#include <iostream>

using namespace std;

int main() {
	int x, y, n;
	long long l;
	cin >> x >> y;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> l;
		if(x % l == 0 && (y - 2) % l == 0 || y % l == 0 && (x - 2) % l == 0 || (x - 1) % l == 0 && (y - 1) % l == 0)
			cout << "YES\n";
		else
			cout << "NO\n";
		
	}
	return 0;
}