#include <bits/stdc++.h>
using namespace std;
const int lim = 1000000;
int tree[5000000], lazy[5000000];
int cost[400000], buy[400000];
void update(int node, int st, int en, int l, int r, int v) {
  if (lazy[node]) {
    tree[node] += lazy[node];
    if (st != en) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (st > r or en < l) return;
  if (st >= l and en <= r) {
    tree[node] += v;
    if (st != en) {
      lazy[node * 2] += v;
      lazy[node * 2 + 1] += v;
    }
    return;
  }
  int mid = (st + en) >> 1;
  update(node * 2, st, mid, l, r, v);
  update(node * 2 + 1, mid + 1, en, l, r, v);
  tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
}
int ck;
void query(int node, int st, int en) {
  if (lazy[node]) {
    tree[node] += lazy[node];
    if (st != en) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (tree[node] <= 0) return;
  if (st == en) {
    ck = st;
    return;
  }
  int mid = (st + en) >> 1;
  query(node * 2 + 1, mid + 1, en);
  if (ck != -1) return;
  query(node * 2, st, mid);
}
int main() {
  int i, j, k, l, m, n;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &cost[i]);
    update(1, 1, lim, 1, cost[i], 1);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &buy[i]);
    update(1, 1, lim, 1, buy[i], -1);
  }
  int q;
  cin >> q;
  while (q--) {
    int ty;
    scanf("%d%d%d", &ty, &l, &k);
    if (ty == 1) {
      update(1, 1, lim, 1, cost[l], -1);
      cost[l] = k;
      update(1, 1, lim, 1, cost[l], 1);
    } else {
      update(1, 1, lim, 1, buy[l], 1);
      buy[l] = k;
      update(1, 1, lim, 1, buy[l], -1);
    }
    ck = -1;
    query(1, 1, lim);
    printf("%d\n", ck);
  }
}
