import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    static PrintWriter out;
    static Reader in;
    public static void main(String[] args) throws IOException {
        //out = new PrintWriter(new File("out.txt"));
        //PrintWriter out = new PrintWriter(System.out);
        //in = new Reader(new FileInputStream("in.txt"));
        //Reader in = new Reader();
        input_output();
        Main solver = new Main();
        solver.solve();
        out.flush();
        out.close();
 
    }
 
    static int INF = (int)1e9-1;
    static int maxn = (int)1e6+5;
    static int mod = 998_244_353;
    static int n, m, q, k, t;

    void solve() throws IOException{
        n = in.nextInt();
        m = in.nextInt();

        int[] cost = new int[n];
        for (int i = 0; i < n; i++) cost[i] = in.nextInt();
        int[] money = new int[m];
        for (int i = 0; i < m; i++) money[i] = in.nextInt();

        tree = new int[maxn*4];
        lazy = new int[maxn*4];


        for (int i = 0; i < n; i++) {
            update(1, 1, maxn, 1, cost[i], 1);
        }
        for (int i = 0; i < m; i++) {
            update(1, 1, maxn, 1, money[i], -1);
        }

        q = in.nextInt();
        for (int i = 0; i < q; i++) {
            int type = in.nextInt(),
                x = in.nextInt()-1,
                y = in.nextInt();

            if (type == 1) {
                update(1, 1, maxn, 1, cost[x], -1);
                cost[x] = y;
                update(1, 1, maxn, 1, cost[x], 1);
            } else {
                update(1, 1, maxn, 1, money[x], 1);
                money[x] = y;
                update(1, 1, maxn, 1, money[x], -1);
            }

            if (tree[1] <= 0) out.println(-1);
            else {
                query(1, 1, maxn);
                out.println(idx);
            }
        }
    }

    //<>

    static int[] tree,lazy;

    static void update(int node,int s,int e,int l,int r, int v){
        relax(node, s, e);
        
        if(e<l || r<s) return;
        
        if(l<=s && e<=r){
            tree[node] += v;
            if(s!=e){
                lazy[2*node] += v;
                lazy[2*node+1] += v;
            }
            return;
        }
        
        int mid = (s+e)/2;
        update(2*node, s, mid, l, r, v);
        update(2*node+1, mid+1, e, l, r, v);
        tree[node] = Math.max(tree[2*node], tree[2*node+1]);
        
    }
    
    static int idx = 0;
    static void query(int node,int s,int e){

        if (s == e) {
            idx = s;
            return;
        }
        
        int mid = (s+e)/2;
        relax(node*2, s, mid);
        relax(node*2+1, mid+1, e);
        int p1 = tree[node*2];
        int p2 = tree[node*2+1];

        if (p2 >= 1) {
            query(node*2+1, mid+1, e);
        } else query(node*2, s, mid);
    }

    static void relax(int node, int s, int e) {
        if (lazy[node] != 0) {
            tree[node] += lazy[node];
            if (s != e) {
                lazy[node*2] += lazy[node];
                lazy[node*2+1] += lazy[node];
            }
            lazy[node] = 0;
        }
    }

    static class Reader {
 
        private InputStream mIs;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
    
        public Reader() {
            this(System.in);
        }
    
        public Reader(InputStream is) {
            mIs = is;
        }
    
        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
    
        }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = mIs.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
    
        public String nextLine() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }
    
        public String next() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
    
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
    
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
    
        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
    
        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    
        public boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
 
    }
    static void input_output() throws IOException {
        File f = new File("in.txt");
        if(f.exists() && !f.isDirectory()) { 
            in = new Reader(new FileInputStream("in.txt"));
        } else in = new Reader();
        f = new File("out.txt");
        if(f.exists() && !f.isDirectory()) {
            out = new PrintWriter(new File("out.txt"));
        } else out = new PrintWriter(System.out);
    }
}