#include <bits/stdc++.h>
using namespace std;
template <typename input_type>
input_type input() {
  input_type inp;
  cin >> inp;
  return inp;
}
const int max_sz = 3e5 + 5, max_nm = 1e6 + 5;
int sz, nm, qr, value, cost[max_sz], ppl[max_sz], sgmnt[4 * max_nm],
    lazy[4 * max_nm];
pair<int, int> query;
inline void shift(int ands) {
  pair<int, int> child = {(ands * 2) + 1, (ands * 2) + 2};
  sgmnt[child.first] += lazy[ands], lazy[child.first] += lazy[ands];
  sgmnt[child.second] += lazy[ands], lazy[child.second] += lazy[ands];
  lazy[ands] = 0;
}
void add(int ands = 0, pair<int, int> range = {0, max_nm}) {
  if ((query.second <= range.first) or (range.second <= query.first)) {
    return;
  } else if ((query.first <= range.first) and (range.second <= query.second)) {
    sgmnt[ands] += value, lazy[ands] += value;
    return;
  }
  int mid = (range.first + range.second) / 2;
  pair<int, int> child = {(ands * 2) + 1, (ands * 2) + 2};
  if (lazy[ands]) {
    shift(ands);
  }
  add(child.first, {range.first, mid});
  add(child.second, {mid, range.second});
  sgmnt[ands] = max(sgmnt[child.first], sgmnt[child.second]);
}
int get(int ands = 0, pair<int, int> range = {0, max_nm}) {
  if (sgmnt[ands] <= 0) {
    return -1;
  } else if (range.second - range.first == 1) {
    return range.first;
  }
  int mid = (range.first + range.second) / 2;
  pair<int, int> child = {(ands * 2) + 1, (ands * 2) + 2};
  if (lazy[ands]) {
    shift(ands);
  }
  int tmp = get(child.second, {mid, range.second});
  if (tmp != -1) {
    return tmp;
  }
  return get(child.first, {range.first, mid});
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  sz = input<int>(), nm = input<int>();
  for (int i = 0; i < sz; i++) {
    cost[i] = input<int>();
    query = {0, cost[i] + 1}, value = 1;
    add();
  }
  for (int i = 0; i < nm; i++) {
    ppl[i] = input<int>();
    query = {0, ppl[i] + 1}, value = -1;
    add();
  }
  qr = input<int>();
  while (qr--) {
    bool type = input<int>() - 1;
    int id = input<int>() - 1, inp = input<int>();
    if (not type) {
      query = {0, cost[id] + 1}, value = -1;
      add();
      cost[id] = inp;
      query = {0, cost[id] + 1}, value = 1;
      add();
    } else {
      query = {0, ppl[id] + 1}, value = 1;
      add();
      ppl[id] = inp;
      query = {0, ppl[id] + 1}, value = -1;
      add();
    }
    cout << get() << endl;
  }
  return 0;
}
