#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int inf = 1e9;
struct node {
  int tp, id, x;
} dt[maxn];
int n, m, q;
int a[maxn], b[maxn];
int d[maxn], tot, num[maxn];
int sum[maxn];
int mx[maxn << 2], add[maxn << 2];
void modify(int id, int d) {
  for (; id <= tot; id += (id & (-id))) sum[id] += d;
}
int query(int i) {
  int res = 0;
  for (; i; i -= (i & (-i))) res += sum[i];
  return res;
}
void build(int x, int l, int r) {
  mx[x] = -inf;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(x << 1, l, mid), build((x << 1) | 1, mid + 1, r);
}
void update(int x) { mx[x] = max(mx[x << 1], mx[(x << 1) | 1]); }
void Add(int x, int d) {
  add[x] += d;
  mx[x] += d;
}
void pushdown(int x) {
  if (add[x]) {
    Add(x << 1, add[x]);
    Add((x << 1) | 1, add[x]);
    add[x] = 0;
  }
}
void modify(int x, int l, int r, int id, int d) {
  if (l == r) {
    mx[x] = d;
    return;
  }
  pushdown(x);
  int mid = (l + r) >> 1;
  if (id <= mid)
    modify(x << 1, l, mid, id, d);
  else
    modify((x << 1) | 1, mid + 1, r, id, d);
  update(x);
}
void modify(int x, int l, int r, int L, int R, int d) {
  if (L <= l && R >= r) {
    Add(x, d);
    return;
  }
  int mid = (l + r) >> 1;
  pushdown(x);
  if (L <= mid) modify(x << 1, l, mid, L, R, d);
  if (R > mid) modify((x << 1) | 1, mid + 1, r, L, R, d);
  update(x);
}
int query(int x, int l, int r) {
  if (mx[x] <= 0) return -1;
  if (l == r) return l;
  int mid = (l + r) >> 1;
  pushdown(x);
  if (mx[(x << 1) | 1] > 0) return query((x << 1) | 1, mid + 1, r);
  return query(x << 1, l, mid);
}
void init() {
  sort(d + 1, d + tot + 1);
  for (int i = 1; i <= n; i++)
    a[i] = lower_bound(d + 1, d + tot + 1, a[i]) - d, a[i] += num[a[i]]++;
  for (int i = 1; i <= q; i++)
    if (dt[i].tp == 1)
      dt[i].x = lower_bound(d + 1, d + tot + 1, dt[i].x) - d,
      dt[i].x += num[dt[i].x]++;
  for (int i = 1; i <= m; i++)
    b[i] = lower_bound(d + 1, d + tot + 1, b[i]) - d, b[i] += num[b[i]]++;
  for (int i = 1; i <= q; i++)
    if (dt[i].tp == 2)
      dt[i].x = lower_bound(d + 1, d + tot + 1, dt[i].x) - d,
      dt[i].x += num[dt[i].x]++;
  build(1, 1, tot);
  for (int i = 1; i <= n; i++) {
    modify(1, 1, tot, a[i], 0);
  }
  for (int i = 1; i <= n; i++) {
    modify(1, 1, tot, 1, a[i], 1);
    modify(a[i], 1);
  }
  for (int i = 1; i <= m; i++) {
    modify(1, 1, tot, 1, b[i], -1);
    modify(b[i], -1);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), d[++tot] = a[i];
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]), d[++tot] = b[i];
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    int tp, id, x;
    scanf("%d %d %d", &tp, &id, &x);
    dt[i] = (node){tp, id, x};
    d[++tot] = x;
  }
  init();
  for (int i = 1; i <= q; i++) {
    if (dt[i].tp == 1) {
      int id = dt[i].id, A = a[id];
      modify(1, 1, tot, 1, A, -1);
      modify(A, -1);
      modify(1, 1, tot, A, -inf);
      modify(1, 1, tot, dt[i].x, n - 1 - m - query(dt[i].x));
      modify(1, 1, tot, 1, dt[i].x, 1);
      modify(dt[i].x, 1);
      a[id] = dt[i].x;
    } else {
      int id = dt[i].id, B = b[id];
      modify(1, 1, tot, 1, B, 1);
      modify(b[id], 1);
      modify(1, 1, tot, 1, dt[i].x, -1);
      modify(dt[i].x, -1);
      b[id] = dt[i].x;
    }
    int ans = query(1, 1, tot);
    if (ans == -1)
      puts("-1");
    else
      printf("%d\n", d[ans]);
  }
}
