import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;

public class Serg5 {
    static int MILLION = 1000000;

    public static void main(String[] args) {
        RangeTree segTree = new RangeTree();
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = in.nextInt();
        int m = in.nextInt();
        int[] a = new int[300001];
        for (int i = 1; i <= n; i++) {
            a[i] = in.nextInt();
            segTree.update(MILLION - a[i], MILLION - 1, -1);
        }
        int[] b = new int[300001];
        for (int i = 1; i <= m; i++) {
            b[i] = in.nextInt();
            segTree.update(MILLION - b[i], MILLION - 1, 1);
        }
        int q = in.nextInt();
        for (int k = 1; k <= q; k++) {
            int t = in.nextInt();
            int i = in.nextInt();
            int x = in.nextInt();
            if (t == 1) {
                segTree.update(MILLION - a[i], MILLION - 1, 1);
                a[i] = x;
                segTree.update(MILLION - a[i], MILLION - 1, -1);
            } else {
                segTree.update(MILLION - b[i], MILLION - 1, -1);
                b[i] = x;
                segTree.update(MILLION - b[i], MILLION - 1, 1);
            }
            if (segTree.minQuery(0, MILLION - 1) >= 0) {
                out.println(-1);
            } else {
                int lower = 0;
                int upper = MILLION - 1;
                int node = 1;
                while (upper > lower) {
                    segTree.pushDown(node, lower, upper);
                    int mid = (lower + upper) / 2;
                    if (segTree.evaluateMin(node << 1, lower, upper) < 0) {
                        node <<= 1;
                        upper = mid;
                    } else {
                        node = (node << 1) + 1;
                        lower = mid + 1;
                    }
                }
                out.println(MILLION - lower);
            }
        }
        out.flush();
        out.close();
    }

    static class RangeTree {
        private long[] min;
        private long[] lazy;
        private int size;
        public RangeTree() {
            this.size = MILLION;
            min = new long[2100000];
            lazy = new long[2100000];
        }
        public void update(int l, int r, int inc) {
            update(1, 0, size-1, l, r, inc);
        }
        private void pushDown(int index, int l, int r) {
            min[index] += lazy[index];
            if(l != r) {
                lazy[2*index] += lazy[index];
                lazy[2*index+1] += lazy[index];
            }
            lazy[index] = 0;
        }
        private void pullUp(int index, int l, int r) {
            int m = (l+r)/2;
            min[index] = Math.min(evaluateMin(2*index, l, m), evaluateMin(2*index+1, m+1, r));
        }
        private long evaluateMin(int index, int l, int r) {
            return min[index] + lazy[index];
        }
        private void update(int index, int l, int r, int left, int right, int inc) {
            if(r < left || l > right) return;
            if(l >= left && r <= right) {
                lazy[index] += inc;
                return;
            }
            pushDown(index, l, r);
            int m = (l+r)/2;
            update(2*index, l, m, left, right, inc);
            update(2*index+1, m+1, r, left, right, inc);
            pullUp(index, l, r);
        }
        public long minQuery(int l, int r) {
            return minQuery(1, 0, size-1, l, r);
        }
        private long minQuery(int index, int l, int r, int left, int right) {
            if(r < left || l > right) return Long.MAX_VALUE;
            if(l >= left && r <= right) {
                return evaluateMin(index, l, r);
            }
            pushDown(index, l, r);
            int m = (l+r)/2;
            long ret = Long.MAX_VALUE;
            ret = Math.min(ret, minQuery(2*index, l, m, left, right));
            ret = Math.min(ret, minQuery(2*index+1, m+1, r, left, right));
            pullUp(index, l, r);
            return ret;
        }
    }
}