#include <cstdio>
using namespace std;

const int MAXN = 1e6 + 5;

int a[MAXN];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &a[i]);
    }
    int m;
    scanf("%d", &m);
    while (m--) {
        int op;
        scanf("%d", &op);
        if (op == 1) {
            int x, y;
            scanf("%d%d", &x, &y);
            a[x] = y;
        } else {
            int l, r, y;
            scanf("%d%d%d", &l, &r, &y);
            int ans = -1;
            for (int p = l; p <= r; ++p) {
                if (a[p] >= y) {
                    ans = p;
                    break;
                }
            }
            printf("%d\n", ans);
        }
    }
    return 0;
}