#include <bits/stdc++.h>
using namespace std;
const int M = 1000007;
int n = 1000000;
int arr[M];
int t[4 * M] = {0};
int lzy[4 * M] = {0};
void build(int a, int L, int R) {
  if (L == R) {
    t[a] = arr[L];
    return;
  }
  int mid = (L + R) / 2;
  build(2 * a, L, mid);
  build(2 * a + 1, mid + 1, R);
  t[a] = max(t[2 * a], t[2 * a + 1]);
}
int query(int a, int L, int R, int ll, int rr) {
  if (rr < ll) return 0;
  if (lzy[a] != 0) {
    int lz = lzy[a];
    lzy[a] = 0;
    if (L != R) {
      lzy[2 * a] += lz;
      lzy[2 * a + 1] += lz;
    }
    t[a] += lz;
  }
  if ((R - L) == (rr - ll)) {
    return t[a];
  }
  int mid = (L + R) / 2;
  return max(query(2 * a, L, mid, ll, min(rr, mid)),
             query(2 * a + 1, mid + 1, R, max(ll, mid + 1), rr));
}
void upd(int a, int L, int R, int ll, int rr, int val) {
  if (lzy[a] != 0) {
    int lz = lzy[a];
    lzy[a] = 0;
    if (L != R) {
      lzy[2 * a] += lz;
      lzy[2 * a + 1] += lz;
    }
    t[a] += lz;
  }
  if (rr < ll) return;
  if ((R - L) == (rr - ll)) {
    t[a] += val;
    if (L != R) {
      lzy[2 * a] += val;
      lzy[2 * a + 1] += val;
    }
    return;
  }
  int mid = (L + R) / 2;
  upd(2 * a, L, mid, ll, min(rr, mid), val);
  upd(2 * a + 1, mid + 1, R, max(ll, mid + 1), rr, val);
  t[a] = max(t[2 * a], t[2 * a + 1]);
}
int find(int L, int R) {
  if (L == R) {
    return L;
  }
  int mid = (L + R) / 2;
  if (query(1, 1, n, mid + 1, R) >= 1)
    return find(mid + 1, R);
  else
    return find(L, mid);
}
int main() {
  int nn, m;
  cin >> nn >> m;
  int cost[nn + 1], b[m + 1];
  for (int i = 1; i <= nn; i++) {
    cin >> cost[i];
    arr[cost[i]]++;
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
    arr[b[i]]--;
  }
  for (int i = n - 1; i > 0; i--) arr[i] += arr[i + 1];
  build(1, 1, n);
  int q;
  cin >> q;
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int ii, xx;
      cin >> ii >> xx;
      upd(1, 1, n, 1, cost[ii], -1);
      cost[ii] = xx;
      upd(1, 1, n, 1, cost[ii], 1);
    } else {
      int ii, xx;
      cin >> ii >> xx;
      upd(1, 1, n, 1, b[ii], 1);
      b[ii] = xx;
      upd(1, 1, n, 1, b[ii], -1);
    }
    if (query(1, 1, n, 1, n) >= 1)
      cout << find(1, n) << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
