#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 300500;
const long long INF = 0x3f3f3f3f;
const long long LINF = 0x1f3f3f3f3f3f3f3f;
const long long MOD = (long long)998244353;
const long long OVER_FLOW = 0xffffffff;
long long n, m, q;
long long price[MAXN], money[MAXN];
long long ans[MAXN << 2];
long long add[MAXN << 2];
long long add_num;
inline long long lchild(long long x) { return x << 1; }
inline long long rchild(long long x) { return x << 1 | 1; }
inline void push_up(long long p) {
  ans[p] = max(ans[lchild(p)], ans[rchild(p)]);
}
void build(long long p, long long l, long long r) {
  add[p] = 0;
  if (l == r) {
    ans[p] = 0;
    return;
  }
  long long mid = (l + r) >> 1;
  build(lchild(p), l, mid);
  build(rchild(p), mid + 1, r);
  push_up(p);
}
inline void f(long long p, long long l, long long r, long long cur_add) {
  add[p] = add[p] + cur_add;
  ans[p] = ans[p] + cur_add;
}
inline void push_down(long long p, long long l, long long r) {
  long long mid = (l + r) >> 1;
  f(lchild(p), l, mid, add[p]);
  f(rchild(p), mid + 1, r, add[p]);
  add[p] = 0;
}
inline void update(long long nl, long long nr, long long l, long long r,
                   long long p) {
  if (nl <= l && r <= nr) {
    ans[p] = (ans[p] + add_num);
    add[p] = (add[p] + add_num);
    return;
  }
  push_down(p, l, r);
  long long mid = (l + r) >> 1;
  if (nl <= mid) update(nl, nr, l, mid, lchild(p));
  if (nr > mid) update(nl, nr, mid + 1, r, rchild(p));
  push_up(p);
}
long long query(long long l, long long r, long long p) {
  long long res = 0;
  if (l == r)
    if (ans[p] > 0)
      return l;
    else
      return -1;
  long long mid = (l + r) >> 1;
  push_down(p, l, r);
  if (ans[rchild(p)] > 0)
    res = query(mid + 1, r, rchild(p));
  else
    res = query(l, mid, lchild(p));
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  const long long r = 1e5 + 5;
  build(1, 1, r);
  for (long long i = 1; i <= n; i++) {
    cin >> price[i];
    add_num = 1;
    update(1, price[i], 1, r, 1);
  }
  for (long long i = 1; i <= m; i++) {
    cin >> money[i];
    add_num = -1;
    update(1, money[i], 1, r, 1);
  }
  cin >> q;
  for (long long i = 1; i <= q; i++) {
    long long u, v, x;
    cin >> u >> v >> x;
    if (u == 1) {
      add_num = -1;
      update(1, price[v], 1, r, 1);
      add_num = 1, price[v] = x;
      update(1, price[v], 1, r, 1);
    } else {
      add_num = 1;
      update(1, money[v], 1, r, 1);
      add_num = -1, money[v] = x;
      update(1, money[v], 1, r, 1);
    }
    cout << query(1, r, 1) << '\n';
  }
  return 0;
}
