/*
TASK:bands
LANG:C++
*/
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
#define MN 20002
long n,m,a[MN];
struct bands
{
    long x,y,c;
};
vector <bands> t;
bool cmp(bands p,bands o)
{
    if(p.y>o.y)return 1;
    else if(p.y=o.y) return p.x>p.y;
    return 0;
}
void addb(long x,long y,long c)
{
    int i;
    for(i=x;i<=y;i++)
        a[i]=c;
    bands s;
    s.x=x;
    s.y=y;
    s.c=c;
    t.push_back(s);
}
void removeb(long x,long y)
{
    
}
void ask(long x)
{
    printf("%ld\n",a[x]);
}
void solve()
{
    long i,j;
    long q,x,y,c;
    string s;
    scanf("%ld%ld",&n,&m);
    for(j=1;j<=m;j++)
    {
        scanf("%ld%ld",&q,&x);
        if(q==2)
            {scanf("%ld",&y);removeb(x,y);}
        if(q==1)
            {scanf("%ld%ld",&y,&c); addb(x,y,c);}
        if(q==3)
            ask(x);
    }
}
int main()
{
    solve();
    //system("pause");
    return 0;
    
}
