#include <bits/stdc++.h>
using namespace std;
vector<pair<int, pair<int, int> > > v;
int x;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int arr[500001];
int tree[500001 * 5];
void init(int node, int b, int e) {
  if (b == e) {
    tree[node] = arr[b];
    return;
  }
  int Left = node * 2;
  int Right = Left + 1;
  int mid = (b + e) / 2;
  init(Left, b, mid);
  init(Right, mid + 1, e);
  tree[node] = gcd(tree[Left], tree[Right]);
}
void query(int node, int b, int e, int i, int j) {
  if (i > e || j < b) return;
  if (b >= i && e <= j) {
    if (tree[node] % x != 0) v.push_back(make_pair(node, make_pair(b, e)));
    return;
  }
  int Left = node * 2;
  int Right = Left + 1;
  int mid = (b + e) / 2;
  query(Left, b, mid, i, j);
  query(Right, mid + 1, e, i, j);
}
void update(int node, int b, int e, int i, int newvalue) {
  if (i > e || i < b) return;
  if (b >= i && e <= i) {
    tree[node] = newvalue;
    return;
  }
  int Left = node * 2;
  int Right = Left + 1;
  int mid = (b + e) / 2;
  if (i <= mid)
    update(Left, b, mid, i, newvalue);
  else
    update(Right, mid + 1, e, i, newvalue);
  tree[node] = gcd(tree[Left], tree[Right]);
}
int rquery(int node, int b, int e) {
  if (b == e) {
    if (tree[node] % x == 0) return 0;
    return 1;
  }
  int Left = node * 2;
  int Right = Left + 1;
  int mid = (b + e) / 2;
  if (tree[Left] % x != 0 && tree[Right] % x != 0)
    return 2;
  else if (tree[Left] % x != 0)
    return rquery(Left, b, mid);
  else
    return rquery(Right, mid + 1, e);
}
int main() {
  int n;
  scanf("%d", &n);
  int i;
  for (i = 1; i <= n; i++) scanf("%d", &arr[i]);
  int q;
  scanf("%d", &q);
  int t, l, r;
  init(1, 1, n);
  int ans;
  while (q--) {
    v.clear();
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d%d%d", &l, &r, &x);
      query(1, 1, n, l, r);
      if (v.size() < 2) {
        if (v.size() == 1) {
          ans = rquery(v[0].first, v[0].second.first, v[0].second.second);
          if (ans < 2)
            cout << "YES" << endl;
          else
            cout << "NO" << endl;
        } else
          cout << "YES" << endl;
      } else
        cout << "NO" << endl;
    } else {
      scanf("%d%d", &l, &r);
      update(1, 1, n, l, r);
    }
  }
  return 0;
}
