#include <bits/stdc++.h>
using namespace std;
void testCase() {}
struct SegmentTree {
  vector<long long> summa;
  vector<long long> suurin;
  vector<long long> lazy;
  long long N;
  SegmentTree(int n) {
    N = n;
    summa.resize(2 * N + 1);
    suurin.resize(2 * N + 1);
    lazy.resize(2 * N + 1);
    for (int i = 0; i < 2 * N; i++) {
      summa[i] = 0;
      suurin[i] = 0;
      lazy[i] = 0;
    }
  }
  void lisaa(int a, int b, long long x) { lisaaHelper(1, 0, N - 1, a, b, x); }
  long long isoin(int a, int b) { return isoinHelper(1, 0, N - 1, a, b); }
  long long get_summa(int a, int b) { return summaHelper(1, 0, N - 1, a, b); }
  int first_positive() { return first_positiveHelper(1, 0, N - 1); }

 private:
  int first_positiveHelper(int k, int a, int b) {
    alas(k, a, b);
    if (suurin[k] <= 0) return -1;
    if (k >= N) return k - N;
    int w = (b - a + 1) / 2;
    alas(2 * k, a, a + w - 1);
    alas(2 * k + 1, a + w, b);
    if (suurin[2 * k + 1] > 0)
      return first_positiveHelper(2 * k + 1, a + w, b);
    else
      return first_positiveHelper(2 * k, a, a + w - 1);
  }

 private:
  void alas(int k, int a, int b) {
    if (lazy[k] == 0) return;
    suurin[k] += lazy[k];
    summa[k] += (b - a + 1) * lazy[k];
    if (2 * k < 2 * N) lazy[2 * k] += lazy[k];
    if (2 * k + 1 < 2 * N) lazy[2 * k + 1] += lazy[k];
    lazy[k] = 0;
  }

 private:
  long long summaHelper(int k, int a, int b, int c, int d) {
    alas(k, a, b);
    if (d < a || c > b) return 0;
    if (a == c && b == d) {
      return summa[k];
    }
    int w = (b - a + 1) / 2;
    long long ans = 0;
    ans += summaHelper(2 * k, a, a + w - 1, c, min(d, a + w - 1));
    ans += summaHelper(2 * k + 1, a + w, b, max(c, a + w), d);
    return ans;
  }

 private:
  long long isoinHelper(int k, int a, int b, int c, int d) {
    alas(k, a, b);
    if (d < a || c > b) return -1e18;
    if (a == c && b == d) {
      return suurin[k];
    }
    int w = (b - a + 1) / 2;
    long long ans = -1e18;
    ans = max(ans, isoinHelper(2 * k, a, a + w - 1, c, min(d, a + w - 1)));
    ans = max(ans, isoinHelper(2 * k + 1, a + w, b, max(c, a + w), d));
    return ans;
  }

 private:
  void lisaaHelper(int k, int a, int b, int c, int d, long long x) {
    alas(k, a, b);
    if (d < a || c > b) return;
    if (a == c && b == d) {
      lazy[k] += x;
      alas(k, a, b);
      return;
    }
    int w = (b - a + 1) / 2;
    lisaaHelper(2 * k, a, a + w - 1, c, min(d, a + w - 1), x);
    lisaaHelper(2 * k + 1, a + w, b, max(c, a + w), d, x);
    suurin[k] = max(suurin[2 * k], suurin[2 * k + 1]);
    summa[k] = summa[2 * k] + summa[2 * k + 1];
  }
};
int a[1000000];
int b[1000000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) cin >> b[i];
  SegmentTree sege((1 << 20));
  for (int i = 1; i <= n; i++) sege.lisaa(1, a[i], 1);
  for (int i = 1; i <= m; i++) sege.lisaa(1, b[i], -1);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int query, ind, x;
    cin >> query >> ind >> x;
    if (query == 1) {
      sege.lisaa(1, a[ind], -1);
      sege.lisaa(1, x, 1);
      a[ind] = x;
    } else {
      sege.lisaa(1, b[ind], 1);
      sege.lisaa(1, x, -1);
      b[ind] = x;
    }
    cout << sege.first_positive() << "\n";
  }
}
