#include <bits/stdc++.h>
using namespace std;
const int N = 333333, X = 1111111;
int a[N], b[N];
int stree[X << 2], lazy[X << 2];
int n, m, q;
void updateLazy(int cl, int cr, int pos) {
  if (lazy[pos]) {
    stree[pos] += lazy[pos];
    if (cl < cr) {
      lazy[pos * 2 + 1] += lazy[pos];
      lazy[pos * 2 + 2] += lazy[pos];
    }
    lazy[pos] = 0;
  }
}
void update(int l, int r, int cl, int cr, int v, int pos) {
  updateLazy(cl, cr, pos);
  if (cl > r || cr < l) {
    return;
  } else if (cl >= l && cr <= r) {
    stree[pos] += v;
    if (cl < cr) {
      lazy[pos * 2 + 1] += v;
      lazy[pos * 2 + 2] += v;
    }
    return;
  }
  int m = cl + (cr - cl) / 2;
  update(l, r, cl, m, v, pos * 2 + 1);
  update(l, r, m + 1, cr, v, pos * 2 + 2);
  stree[pos] = max(stree[pos * 2 + 1], stree[pos * 2 + 2]);
}
int query(int l, int r, int cl, int cr, int pos) {
  updateLazy(cl, cr, pos);
  if (cl > r || cr < l) {
    return 0;
  } else if (cl >= l && cr <= r) {
    return stree[pos];
  }
  int m = cl + (cr - cl) / 2;
  int x = query(l, r, cl, m, pos * 2 + 1);
  int y = query(l, r, m + 1, cr, pos * 2 + 2);
  return max(x, y);
}
int findp(int l, int r, int pos) {
  updateLazy(l, r, pos);
  if (l == r) {
    return stree[pos] > 0 ? l : -1;
  }
  int m = l + (r - l) / 2;
  updateLazy(l, m, pos * 2 + 1);
  updateLazy(m + 1, r, pos * 2 + 2);
  if (stree[pos * 2 + 2] > 0) {
    return findp(m + 1, r, pos * 2 + 2);
  } else if (stree[pos * 2 + 1] > 0) {
    return findp(l, m, pos * 2 + 1);
  }
  return -1;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = (1); i <= (n); i++) {
    cin >> a[i];
    update(0, a[i], 0, X, 1, 0);
  }
  for (int i = (1); i <= (m); i++) {
    cin >> b[i];
    update(0, b[i], 0, X, -1, 0);
  }
  cin >> q;
  while (q--) {
    int t, ind, to, from;
    cin >> t >> ind >> to;
    if (t == 1) {
      from = a[ind];
      update(0, from, 0, X, -1, 0);
      update(0, to, 0, X, 1, 0);
    } else {
      from = b[ind];
      update(0, from, 0, X, 1, 0);
      update(0, to, 0, X, -1, 0);
    }
    cout << findp(0, X, 0) << "\n";
  }
  return 0;
}
