#include <bits/stdc++.h>
using namespace std;
int s, m, a[300005], b[300005], v[4000005], f[4000005];
int read1() {
  int x;
  scanf("%d", &x);
  return x;
}
void down(int d) {
  v[d << 1] += f[d];
  v[d << 1 | 1] += f[d];
  f[d << 1] += f[d];
  f[d << 1 | 1] += f[d];
  f[d] = 0;
}
void up(int d) { v[d] = max(v[d << 1], v[d << 1 | 1]); }
void add(int l, int r, int x, int y, int z, int d) {
  if (l == x && r == y) {
    v[d] += z;
    f[d] += z;
    return;
  }
  int mid = l + r >> 1;
  down(d);
  if (y <= mid)
    add(l, mid, x, y, z, d << 1);
  else if (mid < x)
    add(mid + 1, r, x, y, z, d << 1 | 1);
  else
    add(l, mid, x, mid, z, d << 1), add(mid + 1, r, mid + 1, y, z, d << 1 | 1);
  up(d);
}
int query(int l, int r, int d) {
  if (v[d] <= 0) return -1;
  if (l == r) return l;
  down(d);
  int mid = l + r >> 1;
  if (v[d << 1 | 1] > 0) return query(mid + 1, r, d << 1 | 1);
  return query(l, mid, d << 1);
}
int main() {
  s = read1(), m = read1();
  for (int i = 1; i <= s; ++i) add(1, 1000000, 1, a[i] = read1(), 1, 1);
  for (int i = 1; i <= m; ++i) add(1, 1000000, 1, b[i] = read1(), -1, 1);
  for (int T = read1(); T--;)
    if (read1() & 1) {
      int i = read1();
      add(1, 1000000, 1, a[i], -1, 1);
      add(1, 1000000, 1, a[i] = read1(), 1, 1);
      printf("%d\n", query(1, 1000000, 1));
    } else {
      int i = read1();
      add(1, 1000000, 1, b[i], 1, 1);
      add(1, 1000000, 1, b[i] = read1(), -1, 1);
      printf("%d\n", query(1, 1000000, 1));
    }
  return 0;
}
