#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
const int MAXR = 1e6 + 5;
const int R = 1e6;
int left(int x) { return (x << 1); }
int right(int x) { return (x << 1) + 1; }
bool in(int l, int r, int i, int j) { return (i <= l && j >= r); }
bool out(int l, int r, int i, int j) { return (l > j || r < i); }
int n, m, q, a[MAXN], b[MAXN];
int st[4 * MAXR], lazy[4 * MAXR];
void propagate(int p) {
  st[left(p)] += lazy[p];
  st[right(p)] += lazy[p];
  lazy[left(p)] += lazy[p];
  lazy[right(p)] += lazy[p];
  lazy[p] = 0;
}
void build(int p, int l, int r) {
  if (l == r) {
    st[p] = 0;
  } else {
    int mid = (l + r) / 2;
    build(left(p), l, mid);
    build(right(p), mid + 1, r);
    int p1 = st[left(p)], p2 = st[right(p)];
    st[p] = max(p1, p2);
  }
}
void upd(int p, int l, int r, int i, int j, int val) {
  if (out(l, r, i, j)) return;
  if (in(l, r, i, j)) {
    st[p] += val;
    lazy[p] += val;
    return;
  }
  int mid = (l + r) / 2;
  propagate(p);
  upd(left(p), l, mid, i, j, val);
  upd(right(p), mid + 1, r, i, j, val);
  st[p] = max(st[left(p)], st[right(p)]);
}
int query(int p, int l, int r, int i, int j) {
  if (out(l, r, i, j)) return -R;
  if (in(l, r, i, j)) {
    return st[p];
  }
  int mid = (l + r) / 2;
  propagate(p);
  int p1 = query(left(p), l, mid, i, j);
  int p2 = query(right(p), mid + 1, r, i, j);
  return max(p1, p2);
}
int query2(int p, int l, int r) {
  propagate(p);
  if (l == r) return (st[p] > 0) ? l : -1;
  int mid = (l + r) / 2;
  if (st[right(p)] > 0) {
    return query2(right(p), mid + 1, r);
  } else {
    return query2(left(p), l, mid);
  }
}
int getAns() {
  int l = 1, r = R;
  while (l < r) {
    int mid = (l + r) / 2 + 1;
    int tmp = query(1, 0, R, mid, R);
    if (tmp > 0) {
      l = mid;
    } else {
      r = mid - 1;
    }
  }
  int tmp = query(1, 0, R, l, R);
  if (tmp <= 0) return -1;
  return l;
}
int main() {
  build(1, 0, R);
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    upd(1, 0, R, 0, a[i], 1);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", &b[i]);
    upd(1, 0, R, 0, b[i], -1);
  }
  scanf("%d", &q);
  while (q--) {
    int typ, i, x;
    scanf("%d %d %d", &typ, &i, &x);
    i--;
    if (typ == 1) {
      upd(1, 0, R, 0, a[i], -1);
      a[i] = x;
      upd(1, 0, R, 0, a[i], 1);
    } else {
      upd(1, 0, R, 0, b[i], 1);
      b[i] = x;
      upd(1, 0, R, 0, b[i], -1);
    }
    printf("%d\n", getAns());
  }
}
