#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long double pi = 3.141592653589793238;
const int MOD = 1000000007;
const int N = 1e6 + 10;
int n, m, a[N], b[N];
int seg[4 * N] = {0};
int lazy[4 * N] = {0};
int fun(int a, int b) { return max(a, b); }
void rangeUpdate(int ind, int low, int high, int l, int r, int val) {
  if (lazy[ind] != 0) {
    seg[ind] += lazy[ind];
    if (low != high) {
      lazy[2 * ind + 1] += lazy[ind];
      lazy[2 * ind + 2] += lazy[ind];
    }
    lazy[ind] = 0;
  }
  if (r < low || l > high || low > high) return;
  if (low >= l && high <= r) {
    seg[ind] += val;
    if (low != high) {
      lazy[2 * ind + 1] += val;
      lazy[2 * ind + 2] += val;
    }
    return;
  }
  int mid = (low + high) / 2;
  rangeUpdate(2 * ind + 1, low, mid, l, r, val);
  rangeUpdate(2 * ind + 2, mid + 1, high, l, r, val);
  seg[ind] = fun(seg[2 * ind + 1], seg[2 * ind + 2]);
}
int querylazy(int ind, int low, int high, int l, int r) {
  if (lazy[ind] != 0) {
    seg[ind] += lazy[ind];
    if (low != high) {
      lazy[2 * ind + 1] += lazy[ind];
      lazy[2 * ind + 2] += lazy[ind];
    }
    lazy[ind] = 0;
  }
  if (r < low || l > high || low > high) return 0;
  if (l <= low && high <= r) return seg[ind];
  int mid = (low + high) / 2;
  return fun(querylazy(2 * ind + 1, low, mid, l, r),
             querylazy(2 * ind + 2, mid + 1, high, l, r));
}
void update(int l, int r, int val) { rangeUpdate(0, 0, N - 1, l, r, val); }
int query(int l, int r) { return querylazy(0, 0, N - 1, l, r); }
void dishAdd(int x) { update(1, x, 1); }
void dishRemove(int x) { update(1, x, -1); }
void peopleAdd(int x) { update(1, x, -1); }
void peopleRemove(int x) { update(1, x, 1); }
void print(int x) {
  for (int i = 1; i <= x; i++) cout << query(i, i) << " ";
  cout << '\n';
}
void solve() {
  cin >> n >> m;
  multiset<int> dishes;
  for (int i = 1; i <= n; i++) cin >> a[i], dishes.insert(a[i]);
  for (int i = 1; i <= m; i++) cin >> b[i];
  int q;
  cin >> q;
  for (int i = 1; i <= n; i++) dishAdd(a[i]);
  for (int i = 1; i <= m; i++) peopleAdd(b[i]);
  for (int it = 0; it < q; it++) {
    int t, i, x;
    cin >> t >> i >> x;
    if (t == 1) {
      dishRemove(a[i]);
      a[i] = x;
      dishAdd(a[i]);
    } else {
      peopleRemove(b[i]);
      b[i] = x;
      peopleAdd(b[i]);
    }
    int mn = query(1, N - 1);
    if (mn <= 0) {
      cout << -1 << '\n';
      continue;
    }
    int l = 1, r = N - 1, ans = 1;
    while (l <= r) {
      int m = (l + r) / 2;
      if (query(m, N - 1) > 0)
        ans = m, l = m + 1;
      else
        r = m - 1;
    }
    cout << ans << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
