#include <bits/stdc++.h>
using namespace std;
const int M = 1 << 20;
struct Node {
  int l, r;
  int val, add;
  Node(int _l, int _r) : l(_l), r(_r), val(0), add(0){};
  Node() : val(0), add(0){};
  void Add(int x) {
    add += x;
    val += x;
  }
};
Node tree[2 * M];
void push(int v) {
  tree[2 * v].Add(tree[v].add);
  tree[2 * v + 1].Add(tree[v].add);
  tree[v].add = 0;
}
void build() {
  for (int i = 0; i < M; ++i) tree[M + i] = Node(i, i + 1);
  for (int i = M - 1; i > 0; --i)
    tree[i] = Node(tree[2 * i].l, tree[2 * i + 1].r);
}
void addOnSegm(int v, int l, int r, int val) {
  if (tree[v].l >= r || tree[v].r <= l) return;
  if (l <= tree[v].l && tree[v].r <= r)
    tree[v].Add(val);
  else {
    push(v);
    addOnSegm(2 * v, l, r, val);
    addOnSegm(2 * v + 1, l, r, val);
    tree[v].val = max(tree[2 * v].val, tree[2 * v + 1].val);
  }
}
int getAns(int v) {
  if (tree[v].val <= 0) return -1;
  if (tree[v].l + 1 == tree[v].r) return tree[v].l;
  push(v);
  int res = getAns(2 * v + 1);
  if (res != -1) return res;
  return getAns(2 * v);
}
const int N = 3e5 + 5;
int a[N], b[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  build();
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
    addOnSegm(1, 0, a[i] + 1, 1);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", b + i);
    addOnSegm(1, 0, b[i] + 1, -1);
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    static int type, i, x;
    scanf("%d%d%d", &type, &i, &x);
    --i;
    if (type == 1) {
      addOnSegm(1, 0, a[i] + 1, -1);
      a[i] = x;
      addOnSegm(1, 0, a[i] + 1, 1);
    } else {
      addOnSegm(1, 0, b[i] + 1, 1);
      b[i] = x;
      addOnSegm(1, 0, b[i] + 1, -1);
    }
    printf("%d\n", getAns(1));
  }
}
