#include <bits/stdc++.h>
using namespace std;
template <typename T>
T read1() {
  T t = 0;
  char k;
  bool v = 0;
  do (k = getchar()) == '-' && (v = 1);
  while ('0' > k || k > '9');
  while ('0' <= k && k <= '9')
    t = (t << 3) + (t << 1) + (k ^ '0'), k = getchar();
  return v ? -t : t;
}
int s, m, a[300005], b[300005];
struct node {
  int x, m;
} v[4000005];
void down(int d) {
  v[d << 1].x += v[d].x, v[d << 1].m += v[d].x;
  v[d << 1 | 1].x += v[d].x, v[d << 1 | 1].m += v[d].x;
  v[d].x = 0;
}
void up(int d) { v[d].m = max(v[d << 1].m, v[d << 1 | 1].m); }
void add(int l, int r, int lx, int rx, int x, int d) {
  if (l == lx && r == rx) {
    v[d].m += x;
    v[d].x += x;
    return;
  }
  int mid = l + r >> 1;
  down(d);
  if (rx <= mid)
    add(l, mid, lx, rx, x, d << 1);
  else if (mid < lx)
    add(mid + 1, r, lx, rx, x, d << 1 | 1);
  else
    add(l, mid, lx, mid, x, d << 1),
        add(mid + 1, r, mid + 1, rx, x, d << 1 | 1);
  up(d);
}
int query(int l, int r, int d) {
  if (l == r) return r;
  down(d);
  int mid = l + r >> 1;
  if (v[d << 1 | 1].m > 0) return query(mid + 1, r, d << 1 | 1);
  if (v[d << 1].m > 0) return query(l, mid, d << 1);
  return -1;
}
int main() {
  s = read1<long long>();
  m = read1<long long>();
  for (int i = 1; i <= s; ++i) {
    a[i] = read1<long long>();
    add(1, 1000000, 1, a[i], 1, 1);
  }
  for (int i = 1; i <= m; ++i) {
    b[i] = read1<long long>();
    add(1, 1000000, 1, b[i], -1, 1);
  }
  for (int T = read1<long long>(); T--;)
    if (read1<long long>() & 1) {
      int w = read1<long long>(), v = read1<long long>();
      add(1, 1000000, 1, a[w], -1, 1);
      add(1, 1000000, 1, a[w] = v, 1, 1);
      printf("%d\n", query(1, 1000000, 1));
    } else {
      int w = read1<long long>(), v = read1<long long>();
      add(1, 1000000, 1, b[w], 1, 1);
      add(1, 1000000, 1, b[w] = v, -1, 1);
      printf("%d\n", query(1, 1000000, 1));
    }
  return 0;
}
