#include <bits/stdc++.h>
using namespace std;
typedef struct node {
  int left, right;
  int sum, smin;
} node;
int n, m;
node c[1000111 * 4];
int a[1000111], b[1000111];
int q;
int values[1000111];
void input() {
  scanf("%d%d", &n, &m);
  int number;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &number);
    a[i] = number;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &number);
    b[i] = number;
  }
}
void update(int id) {
  c[id].smin = min(c[id * 2].smin + c[id * 2 + 1].sum, c[id * 2 + 1].smin);
  c[id].sum = c[id * 2].sum + c[id * 2 + 1].sum;
}
void build(int id, int left, int right) {
  if (left > right) return;
  c[id].left = left;
  c[id].right = right;
  if (left == right) {
    c[id].sum = values[left];
    c[id].smin = values[left];
    return;
  }
  int mid = (left + right) / 2;
  build(id * 2, left, mid);
  build(id * 2 + 1, mid + 1, right);
  update(id);
}
void init() {
  for (int i = 1; i <= 450; i++) {
    values[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    values[a[i]]--;
  }
  for (int i = 1; i <= m; i++) {
    values[b[i]]++;
  }
  build(1, 1, 450);
}
void query(int id, int index, int add) {
  if ((index < c[id].left) || (index > c[id].right)) return;
  if (c[id].left == c[id].right) {
    values[index] += add;
    c[id].sum = values[index];
    c[id].smin = values[index];
    return;
  }
  query(id * 2 + 1, index, add);
  query(id * 2, index, add);
  update(id);
}
int getMax(int id, int sum) {
  if (c[id].left == c[id].right) {
    return c[id].left;
  }
  if ((c[id * 2 + 1].smin + sum) < 0) {
    return getMax(id * 2 + 1, sum);
  }
  return getMax(id * 2, sum + c[id * 2 + 1].sum);
}
void solve() {
  scanf("%d", &q);
  int type, index, v;
  for (int i = 1; i <= q; i++) {
    scanf("%d%d%d", &type, &index, &v);
    if (type == 1) {
      query(1, a[index], 1);
      a[index] = v;
      query(1, a[index], -1);
    } else {
      query(1, b[index], -1);
      b[index] = v;
      query(1, b[index], 1);
    }
    if (c[1].smin >= 0) {
      cout << "-1" << endl;
    } else {
      cout << getMax(1, 0) << endl;
    }
  }
}
int main() {
  if (0 == 1) {
    freopen("input.txt", "r", stdin);
  }
  input();
  init();
  solve();
}
