#include <bits/stdc++.h>
using namespace std;
const int nax = 1048576;
struct S {
  int 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 (int i = nax - 1; i > 0; --i) t[i] = comb(t[i << 1], t[i << 1 | 1]);
}
void add(int p, int 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]);
}
int query() {
  if (t[1].min_sum >= 0) return -1;
  int 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);
  int n, m, q;
  cin >> n >> m;
  vector<int> a(n), b(m);
  for (int i = 0; i < n; ++i)
    cin >> a[i], --t[a[i] + nax].sum, --t[a[i] + nax].min_sum;
  for (int i = 0; i < m; ++i)
    cin >> b[i], ++t[b[i] + nax].sum, ++t[b[i] + nax].min_sum;
  build();
  cin >> q;
  while (q--) {
    int 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;
}
