#include <bits/stdc++.h>
using namespace std;
int n, m, q, a[300005], b[300005], val[1000000 + 2];
int seg[4 * 1000000 + 2], lazy[4 * 1000000 + 2];
void build(int node, int start, int end) {
  if (start == end) {
    seg[node] = val[start];
    return;
  }
  int mid = (start + end) >> 1;
  build(node << 1, start, mid);
  build(node << 1 | 1, mid + 1, end);
  seg[node] = max(seg[node << 1], seg[node << 1 | 1]);
}
void update(int node, int start, int end, int l, int r, int val) {
  if (lazy[node] != 0) {
    seg[node] += lazy[node];
    if (start != end) {
      lazy[node << 1] += lazy[node];
      lazy[node << 1 | 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (start > end || start > r || end < l) return;
  if (l <= start && end <= r) {
    seg[node] += val;
    if (start != end) {
      lazy[node << 1] += val;
      lazy[node << 1 | 1] += val;
    }
    return;
  }
  int mid = (start + end) >> 1;
  update(node << 1, start, mid, l, r, val);
  update(node << 1 | 1, mid + 1, end, l, r, val);
  seg[node] = max(seg[node << 1], seg[node << 1 | 1]);
}
void lazify(int node, int start, int end) {
  if (lazy[node] != 0) {
    seg[node] += lazy[node];
    if (start != end) {
      lazy[node << 1] += lazy[node];
      lazy[node << 1 | 1] += lazy[node];
    }
    lazy[node] = 0;
  }
}
int query(int node, int l, int r) {
  lazify(node, l, r);
  if (l == r) {
    if (seg[node] > 0)
      return l;
    else
      return -1;
  }
  int mid = (l + r) / 2;
  lazify(node << 1 | 1, mid + 1, r);
  if (seg[node << 1 | 1] > 0)
    return query(node << 1 | 1, mid + 1, r);
  else
    return query(node << 1, l, mid);
}
void solve() {
  cin >> n >> m;
  for (int i = 1; i < n + 1; i++) {
    int first;
    cin >> first;
    val[first]++;
    a[i] = first;
  }
  for (int i = 1; i < m + 1; i++) {
    int first;
    cin >> first;
    val[first]--;
    b[i] = first;
  }
  for (int i = 1000000; i >= 1; i--) {
    val[i] += val[i + 1];
  }
  build(1, 1, 1000000);
  cin >> q;
  while (q--) {
    int type, id, first;
    cin >> type >> id >> first;
    if (type == 1) {
      update(1, 1, 1000000, 1, a[id], -1);
      a[id] = first;
      update(1, 1, 1000000, 1, a[id], +1);
    } else {
      update(1, 1, 1000000, 1, b[id], +1);
      b[id] = first;
      update(1, 1, 1000000, 1, b[id], -1);
    }
    cout << query(1, 1, 1000000) << '\n';
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
