#include using namespace std; int digit(int N){ int d = 0; while(N > 0){ d++; N /= 10; } return d; } bool Nbeatsu(int N, int X){ if(X % N == 0) return true; int d = 1; for(int i=0; i= N){ if(X % d == N) return true; X /= 10; } return false; } int main(){ int N, Q; cin >> N >> Q; for(int i=0; i> X; if(Nbeatsu(N, X)) cout << "Yes" << endl; else cout << "No" << endl; } }