import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Comparator.comparingInt;
import static java.util.Comparator.comparingLong;

public class Main {
    FastScanner in;
    PrintWriter out;

    int N = 1 << 20;
    int[] A, segTreeMin, segTreeAdd;

    void build() {
        segTreeMin = new int[(N << 2) + 517];
        segTreeAdd = new int[(N << 2) + 517];
        build(1, 0, N - 1);
    }

    void build(int id, int l, int r) {
        if (l == r)
            segTreeMin[id] = A[l];
        else {
            int m = (l + r) / 2;
            build(id * 2, l, m);
            build(id * 2 + 1, m + 1, r);
            upd(id);
        }
    }

    void upd(int id) {
        segTreeMin[id] = min(segTreeMin[id * 2] + segTreeAdd[id * 2], segTreeMin[id * 2 + 1] + segTreeAdd[id * 2 + 1]);
    }

    int lastNeg() {
        return segTreeMin[1] + segTreeAdd[1] >= 0 ? -1 : lastNeg(1, 0, N - 1);
    }

    int lastNeg(int id, int l, int r) {
        if (l == r)
            return l;

        push(id);
        int m = (l + r) / 2;
        if (segTreeMin[id * 2 + 1] + segTreeAdd[id * 2 + 1] < 0)
            return lastNeg(id * 2 + 1, m + 1, r);
        else
            return lastNeg(id * 2, l, m);
    }

    void push(int id) {
        segTreeAdd[id * 2] += segTreeAdd[id];
        segTreeAdd[id * 2 + 1] += segTreeAdd[id];
        segTreeMin[id] += segTreeAdd[id];
        segTreeAdd[id] = 0;
    }

    void add(int l, int r, int v) {
        add(1, 0, N - 1, l, r, v);
    }

    void add(int id, int L, int R, int l, int r, int v) {
        if (r < L || l > R)
            return;

        if (l == L && r == R) {
            segTreeAdd[id] += v;
            return;
        }

        push(id);
        int M = (L + R) / 2;
        add(id * 2, L, M, l, min(r, M), v);
        add(id * 2 + 1, M + 1, R, max(l, M + 1), r, v);
        upd(id);
    }

    private void solve() throws IOException {
        int n = in.nextInt(), m = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = in.nextInt();
        int[] b = new int[m];
        for (int i = 0; i < m; i++)
            b[i] = in.nextInt();

        A = new int[N];
        for (int i = 0; i < n; i++)
            A[a[i]]--;
        for (int i = 0; i < m; i++)
            A[b[i]]++;
        for (int i = N - 2; i >= 0; i--)
            A[i] += A[i + 1];

        build();
        // print();

        for (int q = in.nextInt(); q-- > 0; ) {
            int type = in.nextInt() - 1, id = in.nextInt() - 1, x = in.nextInt();
            if (type == 0) {
                if (a[id] < x) {
                    add(a[id] + 1, x, -1);
                } else if (a[id] > x) {
                    add(x + 1, a[id], +1);
                }
                a[id] = x;
            } else {
                if (b[id] < x) {
                    add(b[id] + 1, x, +1);
                } else if (b[id] > x) {
                    add(x + 1, b[id], -1);
                }
                b[id] = x;
            }
            // print();
            out.println(lastNeg());
        }
    }

    private void print() {
        print(1, 0, N - 1);
        out.println();
    }

    private void print(int id, int l, int r) {
        if (l == r)
            out.print(segTreeMin[id] + segTreeAdd[id] + " ");
        else {
            int m = (l + r) / 2;
            push(id);
            print(id * 2, l, m);
            print(id * 2 + 1, m + 1, r);
        }
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

        boolean hasNextLine() throws IOException {
            return br.ready();
        }
    }

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(".out"));

        for (int t = 1; t-- > 0; )
            solve();

        out.flush();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}