### BUGGY CODE ###

import sys
import time
sys.setrecursionlimit(20000)
def update(Set,x,y,z):
    for i in range(x,y+1):
        Set[i] = z

def lazy_update(Set,x,y,z):
    left = int(x/4)
    if((x%4)!=0):
        left = left + 1
    right = int(y/4)
    for i in range(left,right):
        Set[i] = z
    return left*4,right*4

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    A = [2**31 - 1]*_N
    N = 1
    while True:
        if(N*4 >= _N):
            break
        N += 1
    lazy_A = [None]*N
    #start = time.time()
    #print(A,lazy_A)
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            if(lazy_A[int(query[1]/4)] is not None or lazy_A[int(query[2]/4)] is not None):
                for i in range(int(query[1]/4),int(query[2]/4)+1):
                    if(lazy_A[i] is None):
                        continue
                    A[i*4:i*4+4] = [lazy_A[i]]*4
                    lazy_A[i] = None
                #print("A update from lazy")
                #print(A)
                #print(lazy_A)
                update(A,query[1],query[2],query[3])
                #print("update A")
                #print(A)
            elif(lazy_A[int(query[1]/4)] is None or lazy_A[int(query[2]/4)] is None):
                if(query[2] - query[1] < 4):
                    update(A,query[1],query[2],query[3])
                    #print("A update")
                    #print(A)
                else:
                    right, left = lazy_update(lazy_A,query[1],query[2],query[3])
                    #print("lazy update")
                    #print(lazy_A)
                    if(right > 0):
                        #print("A left update")
                        update(A,query[1],right-1,query[3])
                        #print(A)
                    if(left > 0):
                        #print("A right update")
                        update(A,left,query[2],query[3])
                        #print(A)
        # find
        if(query[0]==1):
            if(lazy_A[int(query[1]/4)] is not None):
                A[int(query[1]/4)*4:int(query[1]/4)*4+4] = [lazy_A[int(query[1]/4)]]*4
                lazy_A[int(query[1]/4)] = None
                #print("A update from lazy")
                #print(A)
            print(A[query[1]])
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")



### FIXED CODE ###

import sys
import math
import time
sys.setrecursionlimit(20000)
INT_MAX = 2**31 - 1

def update(tree,x,y,z,N):
    left = x + N #- 1
    right = y + N#- 1

    while True:
        if(left >= right):
            break
        if(right % 2 == 1):
            right -= 1
            tree[right - 1] = z
        if(left % 2 == 1):
            tree[left - 1] = z
            left += 1

        #left += 1#math.floor((left + 1)/2)
        #right -= 1#math.floor((right - 1)/2)
        left >>= 1
        right >>= 1

def find(tree,x,N):
    x += N - 1
    s = (INT_MAX, -1)
    while True:
        if(x < 0):
            break
        if(tree[x][0] is not None and (tree[x][1] > s[1])):
            s = tree[x]
        x = math.floor((x - 1)/2)
    return s[0]

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    N = 1
    while True:
        if(N >= _N):
            break
        N *= 2
    A = [(None,-1)]*(2*N - 1)

    #start = time.time()
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            update(A,query[1],query[2]+1,(query[3],i),N)
            #print(A)
        # find
        if(query[0]==1):
            #z = find(A,lazy_A,query[1],query[1]+1,0,0,N,N)
            z = find(A,query[1],N)
            print(z)
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")