#include <bits/stdc++.h>
using namespace std;
const long long MX = 1e6 + 3;
long long n, m, arra[MX], arrb[MX], nd[MX * 4], mn[MX * 4], q, lz[MX * 4];
void FLUSH(long long id, long long st, long long en) {
  if (st == en - 1) {
    return;
  }
  long long mid = (st + en) / 2;
  mn[id * 2] += lz[id];
  mn[id * 2 + 1] += lz[id];
  lz[id * 2] += lz[id];
  lz[id * 2 + 1] += lz[id];
  lz[id] = 0;
}
void ADD(long long id, long long st, long long en, long long l, long long r,
         long long val) {
  FLUSH(id, st, en);
  if (st == l && en == r) {
    lz[id] += val;
    mn[id] += val;
    return;
  }
  long long mid = (st + en) / 2;
  if (l < mid) ADD(id * 2, st, mid, l, min(mid, r), val);
  if (r > mid) ADD(id * 2 + 1, mid, en, max(l, mid), r, val);
  mn[id] = min(mn[id * 2], mn[id * 2 + 1]);
}
long long MIN(long long id, long long st, long long en) {
  FLUSH(id, st, en);
  if (st == en - 1) return st;
  long long mid = (st + en) / 2;
  if (mn[id * 2 + 1] < 0)
    return MIN(id * 2 + 1, mid, en);
  else
    return MIN(id * 2, st, mid);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> arra[i];
    ADD(1, 0, MX, 0, arra[i] + 1, -1);
  }
  for (long long i = 0; i < m; i++) {
    cin >> arrb[i];
    ADD(1, 0, MX, 0, arrb[i] + 1, 1);
  }
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long tp, I, val;
    cin >> tp >> I >> val;
    I--;
    if (tp == 1) {
      ADD(1, 0, MX, 0, arra[I] + 1, 1);
      ADD(1, 0, MX, 0, val + 1, -1);
      arra[I] = val;
    } else {
      ADD(1, 0, MX, 0, arrb[I] + 1, -1);
      ADD(1, 0, MX, 0, val + 1, 1);
      arrb[I] = val;
    }
    if (mn[1] >= 0) {
      cout << -1 << endl;
      continue;
    }
    cout << MIN(1, 0, MX) << endl;
  }
  return 0;
}
