#include<bits/stdc++.h>
using namespace std;
typedef long long ll;


vector<int> prime;

vector<pair<int,int>> factorize(int p){
    vector<pair<int,int>> ret;
    for(auto i:prime){
        if(i>p) break;
        int cnt=0;
        while(p%i==0){
            p/=i;
            cnt++;
        }
        if(cnt){
            ret.push_back(make_pair(i,cnt));
        }
    }
    return ret;
} 

int sum[100010][333];

signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);

    int n;
    cin>>n;
    vector<vector<pair<int,int>>> a(n+1);
    bool check[2222]={};

    int pnum[2222]={};
    int cnt=0;
    
    for(int i=2;i<=2000;i++){
        if(check[i]==0){
            for(int j=i+i;j<=2000;j+=i){
                check[j]=1;
            }
            prime.push_back(i);
            pnum[i] = cnt;
            cnt++; 
        }
    }

    for(int i=1;i<=n;i++){
        int t;
        cin>>t;
        a[i] = factorize(t);
        for(auto j:a[i]){
            sum[i][pnum[j.first]]+=j.second;
        }
        for(int j=0;j<333;j++){
            sum[i][j] += sum[i-1][j];
        }
    }
    
    
    


    int q;
    cin>>q;
    while(q--){
        int p,l,r;
        cin>>p>>l>>r;
        l--;
        int c[333];
        for(int i=0;i<333;i++){
            c[i] = sum[r][i] - sum[l][i];
            while(c[i] && p%prime[i]==0){
                p/=prime[i];
                c[i]--;
            }
        }
        if(p==1){
            cout<<"Yes\n";
        }
        else cout<<"NO\n";

    }

    
}