#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);
const int MAXN = 5e5 + 5;
const int MAXM = 2e6 + 5;
const int MOD = 1e9 + 7;
int sgn(double x) {
  if (fabs(x) < eps) return 0;
  if (x < 0)
    return -1;
  else
    return 1;
}
long long pw(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void inc(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
void dec(long long &a, long long b) {
  a -= b;
  if (a < 0) a += MOD;
}
int mul(int a, int b) {
  long long c = 1ll * a * b;
  return c - c / MOD * MOD;
}
int n, m, a[MAXN];
int g[MAXN << 2];
void up(int rt) { g[rt] = gcd(g[rt << 1], g[rt << 1 | 1]); }
void build(int l, int r, int rt) {
  if (l == r) {
    g[rt] = a[l];
    return;
  }
  int mid = l + r >> 1;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
  up(rt);
}
void upd(int pos, int v, int l, int r, int rt) {
  if (l == r) {
    g[rt] = v;
    return;
  }
  int mid = l + r >> 1;
  if (pos <= mid)
    upd(pos, v, l, mid, rt << 1);
  else
    upd(pos, v, mid + 1, r, rt << 1 | 1);
  up(rt);
}
int cnt;
void find(int L, int R, int x, int l, int r, int rt) {
  if (cnt > 1) return;
  if (l == r) {
    if (g[rt] % x != 0) cnt++;
    return;
  }
  int mid = l + r >> 1;
  if (L <= mid && g[rt << 1] % x != 0) find(L, R, x, l, mid, rt << 1);
  if (R > mid && g[rt << 1 | 1] % x != 0)
    find(L, R, x, mid + 1, r, rt << 1 | 1);
}
void qry(int L, int R, int x, int l, int r, int rt) {
  if (cnt > 1) return;
  if (L <= l && r <= R) {
    if (g[rt] % x != 0) find(l, r, x, 1, n, 1);
    return;
  }
  int mid = l + r >> 1;
  if (L <= mid) qry(L, R, x, l, mid, rt << 1);
  if (R > mid) qry(L, R, x, mid + 1, r, rt << 1 | 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n + 1; i++) scanf("%d", &a[i]);
  build(1, n, 1);
  scanf("%d", &m);
  int op, l, r, x, y;
  while (m--) {
    scanf("%d%", &op);
    if (op == 1) {
      scanf("%d%d%d", &l, &r, &x);
      cnt = 0;
      qry(l, r, x, 1, n, 1);
      if (cnt <= 1)
        puts("YES");
      else
        puts("NO");
    } else {
      scanf("%d%d", &x, &y);
      upd(x, y, 1, n, 1);
    }
  }
}
