#include <bits/stdc++.h>
using namespace std;
namespace qwq {
struct st {
  int mi, tag, ls, rs;
} a[2333333];
int ca;
int build(int l, int r) {
  int x = ++ca;
  if (l == r) return x;
  int mid = (l + r) >> 1;
  a[x].ls = build(l, mid);
  a[x].rs = build(mid + 1, r);
  return x;
}
void pd(int x) {
  st &ls = a[a[x].ls], &rs = a[a[x].rs];
  if (a[x].tag) {
    int tag = a[x].tag;
    ls.mi += tag;
    ls.tag += tag;
    rs.mi += tag;
    rs.tag += tag;
    a[x].tag = 0;
  }
}
void upd(int x) { a[x].mi = min(a[a[x].ls].mi, a[a[x].rs].mi); }
int ql, qr, d;
void add(int x, int l, int r) {
  if (qr < l || r < ql) return;
  if (ql <= l && r <= qr) {
    a[x].mi += d;
    a[x].tag += d;
    return;
  }
  int mid = (l + r) >> 1;
  pd(x);
  add(a[x].ls, l, mid);
  add(a[x].rs, mid + 1, r);
  upd(x);
}
int Q(int x, int l, int r) {
  if (l == r) return l;
  pd(x);
  int mid = (l + r) >> 1;
  if (a[a[x].rs].mi < 0) return Q(a[x].rs, mid + 1, r);
  return Q(a[x].ls, l, mid);
}
}  // namespace qwq
int a[333333], b[333333];
using qwq::add;
using qwq::build;
using qwq::d;
using qwq::Q;
using qwq::ql;
using qwq::qr;
int main() {
  build(1, 1000000);
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    ql = 1;
    qr = a[i];
    d = -1;
    add(1, 1, 1000000);
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &b[i]);
    ql = 1;
    qr = b[i];
    d = 1;
    add(1, 1, 1000000);
  }
  int q;
  scanf("%d", &q);
  for (int i = 1; i <= q; ++i) {
    int op, id, x;
    scanf("%d%d%d", &op, &id, &x);
    if (op == 1) {
      ql = 1;
      qr = a[id];
      d = 1;
      add(1, 1, 1000000);
      a[id] = x;
      ql = 1;
      qr = a[id];
      d = -1;
      add(1, 1, 1000000);
    } else {
      ql = 1;
      qr = b[id];
      d = -1;
      add(1, 1, 1000000);
      b[id] = x;
      ql = 1;
      qr = b[id];
      d = 1;
      add(1, 1, 1000000);
    }
    if (qwq::a[1].mi >= 0)
      puts("-1");
    else
      printf("%d\n", Q(1, 1, 1000000));
  }
  return 0;
}
