#include<cstdio> #include<fstream> #include<iostream> #include<iomanip> #include<algorithm> #include<vector> #include<bitset> #include<deque> #include<queue> #include<set> #include<map> #include<cmath> #include<cstring> #include<ctime> #include<cstdlib> #include<unordered_map> #define ll long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define pll pair<ll,ll> #define all(x) (x).begin(), (x).end() #define fi first #define se second using namespace std; int x, y, n, k; int main() { // freopen("test.in", "r", stdin); // freopen("test.out", "w", stdout); scanf("%d%d", &x, &y); scanf("%d", &n); for(; n; n--) { scanf("%d", &k); if(x % k == 0 && (y - 2) % k == 0) printf("YES\n"); else if((x - 2) % k == 0 && y % k == 0) printf("YES\n"); else if(x % k == 1 && (y - 1) % k == 0) printf("YES\n"); else if((x - 1) % k == 0 && y % k == 1) printf("YES\n"); else printf("NO\n"); } return 0; }