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