#include using namespace std; int main() { int x = 0, y = 0, n = 0,e[1001]; cin >> x >> y>>n; for (int i = 0; i < n; i++) { cin >> e[i]; } while (n--) { if ((x - 2) % e[n - 1] == 0 && y%e[n - 1] == 0) { cout << "YES" << endl; } else if ((y - 2) % e[n - 1] == 0 && x%e[n - 1] == 0) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }