#include <bits/stdc++.h>
using namespace std;
int x, y, k;
long long add[100000];
long long a[100000];
long long b[100000];
struct node {
  int left, right;
  int mid() { return (left + right) / 2; }
  long long sum;
  long long maxx;
} tree[100000 << 2], point;
int father[100000 << 2];
void update(int o, int l, int r, int p, int val) {
  if (l == r) {
    tree[o].sum += val;
    tree[o].maxx += val;
    return;
  }
  tree[o].left = l;
  tree[o].right = r;
  int mid = (l + r) >> 1;
  if (p <= mid)
    update(o << 1, l, mid, p, val);
  else
    update(o << 1 | 1, mid + 1, r, p, val);
  tree[o].sum = tree[o << 1].sum + tree[o << 1 | 1].sum;
  tree[o].maxx =
      max(tree[o << 1 | 1].maxx, tree[o << 1].maxx + tree[o << 1 | 1].sum);
}
long long query(int o, int l, int r, node p) {
  if (l == r) {
    return l;
  }
  int mid = (l + r) >> 1;
  node tmp2;
  tmp2.sum = tree[o << 1 | 1].sum + p.sum;
  tmp2.maxx = tree[o << 1 | 1].maxx + p.sum;
  if (tmp2.maxx > 0) {
    return query(o << 1 | 1, mid + 1, r, p);
  } else {
    return query(o << 1, l, mid, p);
  }
}
int main() {
  int n, m, q;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    update(1, 1, 100000, a[i], 1);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%lld", &b[i]);
    update(1, 1, 100000, b[i], -1);
  }
  cin >> q;
  long long type, postion, value;
  for (int i = 1; i <= q; i++) {
    scanf("%lld%lld%lld", &type, &postion, &value);
    if (type == 1) {
      update(1, 1, 100000, a[postion], -1);
      a[postion] = value;
      update(1, 1, 100000, a[postion], 1);
    } else {
      update(1, 1, 100000, b[postion], 1);
      b[postion] = value;
      update(1, 1, 100000, b[postion], -1);
    }
    point.sum = 0;
    point.maxx = 0;
    if (tree[1].maxx <= 0)
      puts("-1");
    else
      cout << query(1, 1, 100000, point) << endl;
  }
  return 0;
}
