#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
const int mod = 998244353;
const ll inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-7;
const int N = 1e6 + 5;
int a[N], b[N];
int mx[N * 4], p[N * 4];
void push(int v, int l, int r) {
  mx[v] += p[v];
  if (r - l > 1) {
    p[v + v + 1] += p[v];
    p[v + v + 2] += p[v];
  }
  p[v] = 0;
}
void upd(int L, int R, int val, int l = 0, int r = N, int v = 0) {
  push(v, l, r);
  if (L <= l && r <= R) {
    p[v] += val;
    push(v, l, r);
    return;
  }
  if (L >= r || l >= R) {
    return;
  }
  int m = (l + r) / 2;
  upd(L, R, val, l, m, v + v + 1);
  upd(L, R, val, m, r, v + v + 2);
  mx[v] = max(mx[v + v + 1], mx[v + v + 2]);
}
int get(int l = 0, int r = N, int v = 0) {
  push(v, l, r);
  if (mx[v] <= 0) return -1;
  if (r - l == 1) return l;
  int m = (l + r) / 2;
  push(v + v + 2, m, r);
  push(v + v + 1, l, m);
  ll res;
  if (mx[v + v + 2] > 0)
    res = get(m, r, v + v + 2);
  else
    res = get(l, m, v + v + 1);
  mx[v] = max(mx[v + v + 1], mx[v + v + 2]);
  return res;
}
int GG(int pos, int l = 0, int r = N, int v = 0) {
  push(v, l, r);
  if (r - l == 1) {
    return mx[v];
  }
  int m = (l + r) / 2;
  ll res;
  if (pos < m)
    res = GG(pos, l, m, v + v + 1);
  else
    res = GG(pos, m, r, v + v + 2);
  mx[v] = max(mx[v + v + 1], mx[v + v + 2]);
  return res;
}
void solve() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    upd(0, a[i] + 1, 1);
  }
  for (int i = 1; i <= m; ++i) {
    cin >> b[i];
    upd(0, b[i] + 1, -1);
  }
  int q;
  cin >> q;
  while (q--) {
    int t, i, x;
    cin >> t >> i >> x;
    if (t == 1) {
      upd(0, a[i] + 1, -1);
      a[i] = x;
      upd(0, a[i] + 1, 1);
    } else {
      upd(0, b[i] + 1, 1);
      b[i] = x;
      upd(0, b[i] + 1, -1);
    }
    cout << get() << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int tt = 1;
  while (tt--) {
    solve();
    cout << "\n";
  }
}
