#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int MAXN = 1000010;
int n, m, q;
int arr[MAXN << 2], tree[MAXN << 2];
int a[MAXN], b[MAXN];
void update_tree(int o, int l, int r, int p, int val) {
  if (l == r) {
    arr[o] += val;
    tree[o] += val;
    return;
  }
  int mid = (l + r) >> 1;
  if (p <= mid)
    update_tree(o << 1, l, mid, p, val);
  else
    update_tree(o << 1 | 1, mid + 1, r, p, val);
  arr[o] = arr[o << 1] + arr[o << 1 | 1];
  tree[o] = max(tree[o << 1 | 1], tree[o << 1] + arr[o << 1 | 1]);
}
struct node {
  int max, sum;
};
int query_tree(int o, int l, int r, node tep) {
  if (l == r) {
    return l;
  }
  int mid = (l + r) >> 1;
  node tep2;
  tep2.sum = tep.sum + arr[o << 1 | 1];
  tep2.max = tree[o << 1 | 1] + tep.sum;
  if (tep2.max > 0) {
    return query_tree(o << 1 | 1, mid + 1, r, tep);
  } else {
    return query_tree(o << 1, l, mid, tep2);
  }
}
int main() {
  while (cin >> n >> m) {
    memset(arr, 0, sizeof(arr));
    memset(tree, 0, sizeof(tree));
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      update_tree(1, 1, MAXN - 1, a[i], 1);
    }
    for (int i = 1; i <= m; i++) {
      scanf("%d", &b[i]);
      update_tree(1, 1, MAXN - 1, b[i], -1);
    }
    cin >> q;
    while (q--) {
      int op, pos, val;
      scanf("%d%d%d", &op, &pos, &val);
      if (op == 1) {
        update_tree(1, 1, MAXN - 1, a[pos], -1);
        update_tree(1, 1, MAXN - 1, a[pos] = val, 1);
      } else {
        update_tree(1, 1, MAXN - 1, b[pos], 1);
        update_tree(1, 1, MAXN - 1, b[pos] = val, -1);
      }
      if (tree[1] <= 0)
        puts("-1");
      else
        printf("%d\n", query_tree(1, 1, MAXN - 1, {0, 0}));
    }
  }
}
