#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int tree[maxn * 4], add[maxn * 4];
void push(int v, int tl, int tr) {
  if (add[v] != 0) {
    tree[v] += add[v];
    if (tl != tr) {
      int vv = v + v;
      add[vv] += add[v];
      add[vv + 1] += add[v];
      tree[v] = max(tree[vv] + add[vv], tree[vv + 1] + add[vv + 1]);
    }
    add[v] = 0;
  }
}
void upd(int v, int tl, int tr, int l, int r, int x) {
  push(v, tl, tr);
  if (tl == l and tr == r) {
    add[v] += x;
    push(v, tl, tr);
    return;
  }
  int tm = tl + tr >> 1, vv = v + v;
  if (r <= tm)
    upd(vv, tl, tm, l, r, x);
  else if (l > tm)
    upd(vv + 1, tm + 1, tr, l, r, x);
  else {
    upd(vv, tl, tm, l, tm, x);
    upd(vv + 1, tm + 1, tr, tm + 1, r, x);
  }
  tree[v] = max(tree[vv] + add[vv], tree[vv + 1] + add[vv + 1]);
}
int get(int v, int tl, int tr) {
  push(v, tl, tr);
  if (tl == tr) return (tree[v] > 0 ? tl : -1);
  int vv = v + v, tm = tl + tr >> 1;
  if (tree[vv + 1] + add[vv + 1] > 0) return get(vv + 1, tm + 1, tr);
  return get(vv, tl, tm);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int a[n], b[m];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    upd(1, 1, maxn, 1, a[i], 1);
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    upd(1, 1, maxn, 1, b[i], -1);
  }
  int q;
  cin >> q;
  while (q--) {
    int type, i, x;
    cin >> type >> i >> x;
    if (type == 1) {
      upd(1, 1, maxn, 1, a[i - 1], -1);
      a[i - 1] = x;
      upd(1, 1, maxn, 1, a[i - 1], 1);
    } else {
      upd(1, 1, maxn, 1, b[i - 1], 1);
      b[i - 1] = x;
      upd(1, 1, maxn, 1, b[i - 1], -1);
    }
    cout << get(1, 1, maxn) << '\n';
  }
  return 0;
}
