#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
int n, m, q;
int sum[maxn << 2], maxx[maxn << 2];
int a[maxn], b[maxn];
void update(int o, int l, int r, int p, int val) {
  if (l == r) {
    sum[o] += val;
    maxx[o] += val;
    return;
  }
  int mid = (l + r) >> 1;
  if (p <= mid)
    update(o << 1, l, mid, p, val);
  else
    update(o << 1 | 1, mid + 1, r, p, val);
  sum[o] = sum[o << 1] + sum[o << 1 | 1];
  maxx[o] = max(maxx[o << 1 | 1], maxx[o << 1] + sum[o << 1 | 1]);
}
struct node {
  int max, sum;
};
int query(int o, int l, int r, node tep) {
  if (l == r) {
    return l;
  }
  int mid = (l + r) >> 1;
  node tep2;
  tep2.sum = tep.sum + sum[o << 1 | 1];
  tep2.max = maxx[o << 1 | 1] + tep.sum;
  if (tep2.max > 0) {
    return query(o << 1 | 1, mid + 1, r, tep);
  } else {
    return query(o << 1, l, mid, tep2);
  }
}
int main() {
  while (cin >> n >> m) {
    memset(sum, 0, sizeof(sum)), memset(maxx, 0, sizeof(maxx));
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      update(1, 1, maxn - 1, a[i], 1);
    }
    for (int i = 1; i <= m; i++) {
      scanf("%d", &b[i]);
      update(1, 1, maxn - 1, b[i], -1);
    }
    cin >> q;
    while (q--) {
      int op, pos, val;
      scanf("%d%d%d", &op, &pos, &val);
      if (op == 1) {
        update(1, 1, maxn - 1, a[pos], -1);
        update(1, 1, maxn - 1, a[pos] = val, 1);
      } else {
        update(1, 1, maxn - 1, b[pos], 1);
        update(1, 1, maxn - 1, b[pos] = val, -1);
      }
      if (maxx[1] <= 0)
        puts("-1");
      else
        printf("%d\n", query(1, 1, maxn - 1, {0, 0}));
    }
  }
}
