#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int C = 26;
void add(int &x, int y) {
  x += y;
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
}
int fix(int x) {
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
  return x;
}
int pw(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % MOD;
    b >>= 1;
    a = 1ll * a * a % MOD;
  }
  return ret;
}
const int MAXN = 1e6 + 10;
int st[MAXN << 2], lz[MAXN << 2];
void weed(int i) {
  for (int j : {i << 1, i << 1 ^ 1}) {
    st[j] += lz[i];
    lz[j] += lz[i];
  }
  lz[i] = 0;
}
void plant(int i, int b, int e, int l, int r, int val) {
  if (l >= r) return;
  if (b == l && e == r) {
    st[i] += val;
    lz[i] += val;
    return;
  }
  int m = (b + e) >> 1;
  weed(i);
  plant(i << 1, b, m, l, min(m, r), val);
  plant(i << 1 ^ 1, m, e, max(m, l), r, val);
  st[i] = min(st[i << 1], st[i << 1 ^ 1]);
}
int descend(int i, int b, int e) {
  if (e - b == 1) return b;
  if (st[i] >= 0) return -1;
  weed(i);
  int m = (b + e) >> 1;
  if (st[i << 1 ^ 1] < 0) return descend(i << 1 ^ 1, m, e);
  return descend(i << 1, b, m);
}
int n, m, a[MAXN], b[MAXN];
void solve() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    plant(1, 0, MAXN, 0, a[i] + 1, -1);
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    plant(1, 0, MAXN, 0, b[i] + 1, 1);
  }
  int queries;
  cin >> queries;
  while (queries--) {
    int type;
    cin >> type;
    if (type == 1) {
      int i, x;
      cin >> i >> x;
      --i;
      plant(1, 0, MAXN, 0, a[i] + 1, 1);
      a[i] = x;
      plant(1, 0, MAXN, 0, a[i] + 1, -1);
    } else if (type == 2) {
      int i, x;
      cin >> i >> x;
      --i;
      plant(1, 0, MAXN, 0, b[i] + 1, -1);
      b[i] = x;
      plant(1, 0, MAXN, 0, b[i] + 1, 1);
    }
    int ans = descend(1, 0, MAXN);
    cout << ans << "\n";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int te = 1;
  for (int w = 1; w <= te; w++) {
    solve();
  }
  return 0;
}
