#include <bits/stdc++.h>
using namespace std;
const int N= 2e5 + 5 ;
int tree[ 4 * N] , sz;
void init( int n)
{
sz= 1 ;
while ( sz< n)
sz* = 2 ;
}
int query( int i, int node, int lx, int rx)
{
if ( rx- lx== 1 )
return tree[ node] ;
int mid= ( lx+ rx) / 2 ;
if ( tree[ node] ! = - 1 )
{
tree[ 2 * node+ 1 ] = tree[ node] ;
tree[ 2 * node+ 2 ] = tree[ node] ;
}
tree[ node] = - 1 ;
if ( i< mid)
return query( i, 2 * node+ 1 , lx, mid) ;
return query( i, 2 * node+ 2 , mid, rx) ;
}
void update( int l, int r, int v, int node, int lx, int rx)
{
if ( lx>= r || rx<= l)
return ;
if ( lx>= l && rx<= r)
{
tree[ node] = v;
return ;
}
int mid= ( lx+ rx) / 2 ;
update( l, r, v, 2 * node+ 1 , lx, mid) ;
update( l, r, v, 2 * node+ 2 , mid, rx) ;
}
void solve( )
{
int n, m;
cin >> n>> m;
for ( int i= 0 ; i< 4 * N; i++ )
tree[ i] = - 1 ;
init( n) ;
while ( m-- )
{
int op;
cin >> op;
if ( op== 2 )
{
int i;
cin >> i;
int ans= query( i, 0 , 0 , sz) ;
if ( ans== - 1 )
cout << 0 << endl;
else
cout << ans<< endl;
}
else
{
int l, r, v;
cin >> l>> r>> v;
update( l, r, v, 0 , 0 , sz) ;
}
}
}
signed main( ) {
fastio
// int t;cin>>t;while(t--)
solve( ) ;
return 0 ;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgTj0yZTUrNTsKaW50IHRyZWVbNCpOXSwgc3o7Cgp2b2lkIGluaXQoaW50IG4pCnsKCXN6PTE7Cgl3aGlsZShzejxuKQoJCXN6Kj0yOwp9CgppbnQgcXVlcnkoaW50IGksIGludCBub2RlLCBpbnQgbHgsIGludCByeCkKewoJaWYocngtbHg9PTEpCgkJcmV0dXJuIHRyZWVbbm9kZV07CglpbnQgbWlkPShseCty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