#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("vpt")
#pragma GCC optimize("rename-registers")
#pragma GCC optimize("move-loop-invariants")
#pragma GCC optimize("unswitch-loops")
#pragma GCC optimize("branch-target-load-optimize2")
#pragma GCC optimize("btr-bb-exclusive")
using namespace std;
const long long nax = 1000005, inf = 1000000007;
struct S {
  long long sum, min_sum;
} t[nax << 1];
S comb(S a, S b) { return {a.sum + b.sum, min(b.min_sum, a.min_sum + b.sum)}; }
void build() {
  for (long long i = nax - 1; i > 0; --i) t[i] = comb(t[i << 1], t[i << 1 | 1]);
}
void add(long long p, long long val) {
  p += nax;
  t[p].sum += val, t[p].min_sum += val;
  for (p >>= 1; p > 0; p >>= 1) t[p] = comb(t[p << 1], t[p << 1 | 1]);
}
long long query() {
  if (t[1].min_sum >= 0) return -1;
  long long i = 1, s = 0;
  while (i < nax) {
    if (s + t[i << 1 | 1].min_sum < 0)
      i = i << 1 | 1;
    else
      s += t[i << 1 | 1].sum, i <<= 1;
  }
  return i - nax;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long n, m, q;
  cin >> n >> m;
  vector<long long> a(n), b(m);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    --t[a[i] + nax].sum, --t[a[i] + nax].min_sum;
  }
  for (long long i = 0; i < m; ++i) {
    cin >> b[i];
    ++t[b[i] + nax].sum, ++t[b[i] + nax].min_sum;
  }
  build();
  cin >> q;
  while (q--) {
    long long cmd, i, x;
    cin >> cmd >> i >> x;
    --i;
    if (cmd & 1) {
      add(a[i], 1), add(a[i] = x, -1);
    } else {
      add(b[i], -1), add(b[i] = x, 1);
    }
    cout << query() << '\n';
  }
  return 0;
}
