# Original solution
import sys
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 = list(map(int, input().split()))
    A = [2**31 - 1]*_N
    N = 1
    while True:
        if(N*4 >= _N):
            break
        N += 1
    lazy_A = [None]*N
    #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)
            if(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]]))



# Optimized solution
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 = list(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]")