#include <bits/stdc++.h>
using namespace std;
inline long long Min(long long x, long long y) { return x < y ? x : y; }
inline void read(long long &x) {
  x = 0;
  long long f = 1;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = (x << 3) + (x << 1) + (s ^ 48);
    s = getchar();
  }
  x *= f;
}
struct node {
  struct SegMentTree {
    long long Val, Lazy;
  } Tree[1300005 << 2];
  inline void PushDown(long long x) {
    if (!Tree[x].Lazy) return;
    Tree[x << 1].Val += Tree[x].Lazy;
    Tree[x << 1].Lazy += Tree[x].Lazy;
    Tree[x << 1 | 1].Val += Tree[x].Lazy;
    Tree[x << 1 | 1].Lazy += Tree[x].Lazy;
    Tree[x].Lazy = 0;
  }
  void Modify(long long x, long long l, long long r, long long Ql, long long Qr,
              long long w) {
    if (l == r) {
      Tree[x].Val += w;
      return;
    }
    if (Ql <= l && r <= Qr) {
      Tree[x].Val += w;
      Tree[x].Lazy += w;
      return;
    }
    PushDown(x);
    long long Mid = (l + r) / 2;
    if (Qr <= Mid)
      Modify(x << 1, l, Mid, Ql, Qr, w);
    else if (Ql > Mid)
      Modify(x << 1 | 1, Mid + 1, r, Ql, Qr, w);
    else
      Modify(x << 1, l, Mid, Ql, Mid, w),
          Modify(x << 1 | 1, Mid + 1, r, Mid + 1, Qr, w);
    Tree[x].Val = Min(Tree[x << 1].Val, Tree[x << 1 | 1].Val);
  }
  long long Query(long long x, long long l, long long r) {
    long long Mid = (l + r) / 2;
    if (Tree[x].Val >= 0) return -1;
    if (l == r) return Mid;
    PushDown(x);
    long long Rson = Query(x << 1 | 1, Mid + 1, r);
    if (Rson != -1) return Rson;
    return Query(x << 1, l, Mid);
    Tree[x].Val = Min(Tree[x << 1].Val, Tree[x << 1 | 1].Val);
  }
} _;
long long a[1300005], b[1300005];
int main() {
  long long n, m;
  read(n);
  read(m);
  for (register long long i = 1; i <= n; ++i) {
    read(a[i]);
    _.Modify(1, 1, 1300005 - 5, 1, a[i], -1);
  }
  for (register long long i = 1; i <= m; ++i) {
    read(b[i]);
    _.Modify(1, 1, 1300005 - 5, 1, b[i], 1);
  }
  long long q;
  read(q);
  while (q--) {
    long long Opt, x, Val;
    read(Opt);
    read(x);
    read(Val);
    if (Opt == 1) {
      _.Modify(1, 1, 1300005 - 5, 1, a[x], 1);
      _.Modify(1, 1, 1300005 - 5, 1, Val, -1);
      a[x] = Val;
    } else {
      _.Modify(1, 1, 1300005 - 5, 1, b[x], -1);
      _.Modify(1, 1, 1300005 - 5, 1, Val, 1);
      b[x] = Val;
    }
    printf("%lld\n", _.Query(1, 1, 1300005 - 5));
  }
  return 0;
}
