#include <bits/stdc++.h>
class SegmentTree {
  friend int Solve(SegmentTree& segmentTree, int v, int vl, int vr);
  friend int Solve(SegmentTree& segmentTree) {
    return Solve(segmentTree, 1, 1, segmentTree.n);
  }

 public:
  SegmentTree(int n_) : n(n_), tree(n_ * 4, 0), lazy(n_ * 4, 0) {}
  void Add(int l, int r, int addend) { Add(1, 1, n, l, r, addend); }
  int Max(int l, int r) { return Max(1, 1, n, l, r); }

 private:
  void Push(int v);
  void Add(int v, int vl, int vr, int l, int r, int addend);
  int Max(int v, int vl, int vr, int l, int r);
  int n;
  std::vector<int> tree, lazy;
};
void SegmentTree::Push(int v) {
  tree[v] += lazy[v];
  if (v * 2 < tree.size()) {
    lazy[v * 2] += lazy[v];
    lazy[v * 2 + 1] += lazy[v];
  }
  lazy[v] = 0;
}
void SegmentTree::Add(int v, int vl, int vr, int l, int r, int addend) {
  if (vl == l && vr == r) {
    lazy[v] += addend;
    return;
  }
  Push(v);
  int vm = vl + (vr - vl) / 2;
  if (r <= vm)
    Add(v * 2, vl, vm, l, r, addend);
  else if (l > vm)
    Add(v * 2 + 1, vm + 1, vr, l, r, addend);
  else {
    Add(v * 2, vl, vm, l, vm, addend);
    Add(v * 2 + 1, vm + 1, vr, vm + 1, r, addend);
  }
  Push(v * 2);
  Push(v * 2 + 1);
  tree[v] = std::max(tree[v * 2], tree[v * 2 + 1]);
}
int SegmentTree::Max(int v, int vl, int vr, int l, int r) {
  Push(v);
  if (vl == l && vr == r) return tree[v];
  int vm = vl + (vr - vl) / 2;
  if (r <= vm)
    return Max(v * 2, vl, vm, l, r);
  else if (l > vm)
    return Max(v * 2 + 1, vm + 1, vr, l, r);
  else
    return std::max(Max(v * 2, vl, vm, l, vm),
                    Max(v * 2 + 1, vm + 1, vr, vm + 1, r));
}
int Solve(SegmentTree& segmentTree, int v, int vl, int vr) {
  segmentTree.Push(v);
  if (vl == vr) return segmentTree.tree[v] > 0 ? vr : -1;
  int vm = vl + (vr - vl) / 2;
  int ans = Solve(segmentTree, v * 2 + 1, vm + 1, vr);
  if (ans == -1) ans = Solve(segmentTree, v * 2, vl, vm);
  return ans;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  const int maxMoney = 1000000;
  int n, m;
  std::cin >> n >> m;
  std::vector<int> price(n), cash(m);
  SegmentTree segmentTree(maxMoney);
  for (int i = 0; i < n; ++i) {
    std::cin >> price[i];
    segmentTree.Add(1, price[i], 1);
  }
  for (int i = 0; i < m; ++i) {
    std::cin >> cash[i];
    segmentTree.Add(1, cash[i], -1);
  }
  int queryNumber;
  std::cin >> queryNumber;
  while (queryNumber--) {
    int queryType;
    std::cin >> queryType;
    if (queryType == 1) {
      int i, newPrice;
      std::cin >> i >> newPrice;
      --i;
      segmentTree.Add(1, price[i], -1);
      segmentTree.Add(1, newPrice, 1);
    } else {
      int i, newCash;
      std::cin >> i >> newCash;
      --i;
      segmentTree.Add(1, cash[i], 1);
      segmentTree.Add(1, newCash, -1);
    }
    std::cout << Solve(segmentTree) << '\n';
  }
  char I;
  std::cin >> I;
}
