#include <bits/stdc++.h>
const int maxn = 1e5 + 5, inf = 1e9 + 7;
int n, m, a[maxn], minn = inf;
template <typename T>
inline T min(T a, T b) {
  return a < b ? a : b;
}
struct sgt_1 {
  struct node {
    node *l, *r;
    int tag, minn;
    node() {
      l = r = 0;
      tag = 0, minn = inf;
    }
    void push_up() {
      if (!l && !r) return;
      minn = min(l ? l->minn : inf, r ? r->minn : inf);
    }
    void push_down() {
      if (!tag || (!l && !r)) return;
      node *pl = new node;
      *pl = *l;
      pl->minn = pl->tag = tag;
      l = pl;
      node *pr = new node;
      *pr = *r;
      pr->minn = pr->tag = tag;
      r = pr;
      tag = 0;
    }
    void init() { *this = node(); }
  } * rt[maxn];
  node *&operator[](const int &id) { return rt[id]; }
  node *build(int l, int r) {
    node *now = new node;
    if (l == r) {
      now->minn = a[l];
      return now;
    }
    int mid = (l + r) >> 1;
    now->l = build(l, mid), now->r = build(mid + 1, r);
    return now->push_up(), now;
  }
  node *modify(int _l, int _r, node *las, int l, int r, int val) {
    if (l > _r || r < _l) return las;
    node *now = new node;
    *now = *las;
    if (_l <= l && r <= _r) {
      now->tag = now->minn = val;
      return now;
    }
    now->push_down();
    int mid = (l + r) >> 1;
    now->l = modify(_l, _r, now->l, l, mid, val),
    now->r = modify(_l, _r, now->r, mid + 1, r, val);
    return now->push_up(), now;
  }
  int wonder(int _l, int _r, node *now, int l, int r) {
    if (l > _r || r < _l) return inf;
    if (_l <= l && r <= _r) return now->minn;
    now->push_down();
    int mid = (l + r) >> 1;
    return min(wonder(_l, _r, now->l, l, mid),
               wonder(_l, _r, now->r, mid + 1, r));
  }
} s_1;
struct sgt_2 {
  struct node {
    node *l, *r;
    int tag, minn;
    node() {
      l = r = 0;
      tag = 0, minn = inf;
    }
    void push_up() {
      if (!l && !r) return;
      minn = min(l ? l->minn : inf, r ? r->minn : inf);
    }
    void push_down() {
      if (!tag) return;
      l->tag = l->minn = tag, r->tag = r->minn = tag;
      tag = 0;
    }
    void init() { *this = node(); }
  } * rt;
  node *build(int l, int r) {
    node *now = new node;
    if (l == r) {
      now->minn = minn;
      return now;
    }
    int mid = (l + r) >> 1;
    now->l = build(l, mid), now->r = build(mid + 1, r);
    return now->push_up(), now;
  }
  void modify(int _l, int _r, node *now, int l, int r, int val) {
    if (l > _r || r < _l) return;
    if (_l <= l && r <= _r) {
      now->tag = now->minn = val;
      return;
    }
    now->push_down();
    int mid = (l + r) >> 1;
    modify(_l, _r, now->l, l, mid, val),
        modify(_l, _r, now->r, mid + 1, r, val);
    return now->push_up();
  }
  int wonder(int _l, int _r, node *now, int l, int r) {
    if (l > _r || r < _l) return inf;
    if (_l <= l && r <= _r) return now->minn;
    now->push_down();
    int mid = (l + r) >> 1;
    return min(wonder(_l, _r, now->l, l, mid),
               wonder(_l, _r, now->r, mid + 1, r));
  }
} s_2, s_3;
inline int where(int key) { return (key - 1) / n + 1; }
void solve(int id) {
  int watch = s_3.wonder(id, id, s_3.rt, 1, m);
  if (watch) {
    s_1[id] = s_1.modify(1, n, s_1[id], 1, n, watch);
    s_3.modify(id, id, s_3.rt, 1, m, 0);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), minn = min(minn, a[i]);
  s_1.rt[1] = s_1.build(1, n);
  s_2.rt = s_2.build(1, m);
  minn = 0;
  s_3.rt = s_3.build(1, m);
  for (int i = 2; i <= m; i++) s_1.rt[i] = s_1.rt[i - 1];
  int q;
  scanf("%d", &q);
  for (int ___ = 1; ___ <= q; ___++) {
    int opt;
    scanf("%d", &opt);
    if (opt == 1) {
      int l, r, x;
      scanf("%d%d%d", &l, &r, &x);
      int idl = where(l), idr = where(r);
      l -= (idl - 1) * n, r -= (idr - 1) * n;
      if (idl == idr) {
        solve(idl);
        s_1[idl] = s_1.modify(l, r, s_1.rt[idl], 1, n, x);
        s_2.modify(idl, idl, s_2.rt, 1, m, s_1.wonder(1, n, s_1[idl], 1, n));
        continue;
      }
      solve(idl);
      s_1[idl] = s_1.modify(l, n, s_1[idl], 1, n, x);
      s_2.modify(idl, idl, s_2.rt, 1, m, s_1.wonder(1, n, s_1[idl], 1, n));
      solve(idr);
      s_1[idr] = s_1.modify(1, r, s_1[idr], 1, n, x);
      s_2.modify(idr, idr, s_2.rt, 1, m, s_1.wonder(1, n, s_1[idr], 1, n));
      if (idl != idr)
        s_2.modify(idl + 1, idr - 1, s_2.rt, 1, m, x),
            s_3.modify(idl + 1, idr - 1, s_3.rt, 1, m, x);
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      int idl = where(l), idr = where(r);
      l -= (idl - 1) * n, r -= (idr - 1) * n;
      solve(idl);
      if (idl != idr) solve(idr);
      if (idl == idr)
        printf("%d\n", s_1.wonder(l, r, s_1[idl], 1, n));
      else {
        int temp = inf;
        if (idl != idr) temp = s_2.wonder(idl + 1, idr - 1, s_2.rt, 1, m);
        temp = min(temp, min(s_1.wonder(l, n, s_1[idl], 1, n),
                             s_1.wonder(1, r, s_1[idr], 1, n)));
        printf("%d\n", temp);
      }
    }
  }
  return 0;
}
