#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(int argc, char* argv[]) { long long xx; long long yy; int N; cin >> xx >> yy; cin >> N; for (int ii = 0; ii < N; ++ii) { long long K; cin >> K; if (((xx - 1) % K == 0 && (yy - 1) % K == 0) || (xx % K == 0 && (yy - 2) % K == 0) || ((xx - 2) % K == 0 && yy % K == 0)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }