/*
    STARK_BOY
*/
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repe(i,a,b) for(ll i=a;i<=b;i++)
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef long long ll;
typedef vector< ll > vi;
typedef vector<pair<ll,ll> > vpii;
typedef pair<ll,ll> pii;
#define all(c) c.begin(),c.end()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define setbitc(x) __builtin_popcount(x)
#define init(x,a) memset(x,a,sizeof(x))
#define INF 1000000000  
#define MOD 1000000007
#define MO 1000000006
#define M 998244353
#define PI           3.14159265358979323846  /* pi */
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
ll modExpo(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return modExpo((x*x)%MOD,n/2);
    else                             //n is odd
        
        return (x*modExpo((x*x)%MOD,(n-1)/2))%MOD;

}
ll modInverse(ll n) 
{ 
    return modExpo(n,MOD-2); 
}
#define N 1000000
//Variables Start   
ll n,m,k,ar[N],seg[4*N],lazy[4*N];
string s,s1;
//Variables End
void push(ll node)
{
    seg[node]+=lazy[node];
    lazy[2*node]+=lazy[node];
    lazy[2*node+1]+=lazy[node];
    lazy[node]=0;

}
void update(ll node,ll l,ll r,ll st,ll en,ll val)
{
    push(node);
    if(l>en||r<st)return;
    if( st<=l && r<=en)
    {
        lazy[node]+=val;
        push(node);
        return;
    }
    ll mid=(l+r)>>1;
    update(2*node,l,mid,st,en,val);
    update(2*node+1,mid+1,r,st,en,val);
    seg[node]=max(seg[2*node],seg[2*node+1]);

}
ll query(ll node,ll l,ll r)
{
    if(l>N || r<1)return -1;
    if(l==r)return l;
    push(node);
    push(2*node);
    push(2*node+1);
    ll mid=(l+r)>>1;
    if(seg[2*node+1]>0)return query(2*node+1,mid+1,r);
    if(seg[2*node]>0)return query(2*node,l,mid);
    return -1;
}
int main()
{
    ios
    int ti=1;
    //cin>>ti;
    while(ti--)
    {
        vi a,b;
        cin>>n>>m;
        rep(i,0,n)
        {
            ll x;cin>>x;
            a.pb(x);
            update(1,1,N,1,x,1);
        }
        rep(i,0,m)
        {
            ll x;cin>>x;
            b.pb(x);
            update(1,1,N,1,x,-1);
        }
        cin>>k;
        while(k--)
        {
            ll ty,ind,val;
            cin>>ty>>ind>>val;
            ind--;
            if(ty==1)
            {
                update(1,1,N,1,a[ind],-1);
                a[ind]=val;
                update(1,1,N,1,a[ind],1);
            }
            else
            {
                update(1,1,N,1,b[ind],1);
                b[ind]=val;
                update(1,1,N,1,b[ind],-1);

            }
            cout<<query(1,1,N)<<endl;
        }
    }
    return 0;
        
}