#include
using namespace std;
int main() {
int a;
cin>>a;
int arr[a];
for(int i=0;i<a;i++)
cin>>arr[i];
int n,k=0;
cin>>n;
int s,b;
while(n–){
cin>>s>>b;
for(int i=0;i<a;i++){
if(s%arr[i]==0 && s>=arr[i])
k++;
//cout<<k<<endl;
}
if(k==b)
cout<<“Yes”<<endl;
else
cout<<“No”<<endl;
k=0;
}
return 0;
}