#include <iostream>

using namespace std;

int x, y, t, k;
int main() {
cin >> x >> y;
cin >> t;

while(t) {
cin >> k;
--t;
if((x * y) % k == 0) {
cout << "YES\n";
}
else {
cout << "NO\n";
}
}

return 0;
}