#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 100;
int tag[N << 1], maxx[N << 1];
int a[N], b[N];
void pushdown(int rt, int l, int r) {
  if (tag[rt]) {
    tag[rt << 1] += tag[rt];
    tag[rt << 1 | 1] += tag[rt];
    maxx[rt << 1] += tag[rt];
    maxx[rt << 1 | 1] += tag[rt];
    tag[rt] = 0;
  }
}
void update(int rt, int nl, int nr, int l, int r, int x) {
  if (nl <= l && r <= nr) {
    maxx[rt] += x;
    tag[rt] += x;
    return;
  }
  int mid = (l + r) >> 1;
  pushdown(rt, l, r);
  if (nl <= mid) update(rt << 1, nl, nr, l, mid, x);
  if (nr > mid) update(rt << 1 | 1, nl, nr, mid + 1, r, x);
  maxx[rt] = max(maxx[rt << 1 | 1], maxx[rt << 1]);
}
int query(int rt, int l, int r) {
  if (l == r) {
    return l;
  }
  int mid = (l + r) >> 1;
  pushdown(rt, l, r);
  if (maxx[rt << 1 | 1] > 0) {
    return query(rt << 1 | 1, mid + 1, r);
  }
  return query(rt << 1, l, mid);
}
int main() {
  int n, m, q;
  scanf("%d %d", &n, &m);
  memset(maxx, 0, sizeof(maxx));
  memset(tag, 0, sizeof(tag));
  for (int i = 1; i <= n; i++)
    scanf("%d", &a[i]), update(1, 1, a[i], 1, 2000002, 1);
  for (int i = 1; i <= m; i++)
    scanf("%d", &b[i]), update(1, 1, b[i], 1, 2000002, -1);
  cout << query(1, 1, 2000002) << endl;
  scanf("%d", &q);
  while (q--) {
    int op, id, num;
    scanf("%d %d %d", &op, &id, &num);
    if (op == 1) {
      if (num < a[id]) update(1, num + 1, a[id], 1, 2000002, -1);
      if (num > a[id]) update(1, a[id] + 1, num, 1, 2000002, 1);
    } else {
      if (num < b[id]) update(1, num + 1, b[id], 1, 2000002, 1);
      if (num > b[id]) update(1, b[id] + 1, num, 1, 2000002, -1);
    }
    int ok = query(1, 1, 2000002);
    if (maxx[1] <= 0)
      puts("-1");
    else
      printf("%d\n", query(1, 1, 2000002));
  }
  return 0;
}
