import Prelude hiding (elem)
import Control.Applicative
import Control.Monad.State
data LazySegTree a =  Leaf a | Elem { eSize :: Int, elem :: a} | Tree { size :: Int
                                                                      , left :: LazySegTree a
                                                                      , right :: LazySegTree a
                                                                      , lazy :: Bool
                                                                      } deriving (Show)

main = do
    [n, q] <- map read.words<$>getLine
    let init = fromList $ replicate n (2^31 - 1)
    evalStateT (query q) init

query :: Int -> StateT (LazySegTree Int) IO ()
query 0 = return ()
query n  = do
    getQuery
    query (n-1)

getQuery :: StateT (LazySegTree Int) IO ()
getQuery = do
    (x:xs) <- lift $ map read.words<$>getLine
    case x of
      0 -> let [s,t,x] = xs in modify (\tr -> updateT tr s t x)
      1 -> let [i] = xs in get >>= \tr -> (lift $ print $ findT tr i)

isElem :: LazySegTree a -> Bool
isElem (Elem _ _) = True
isElem _          = False

fromList :: [a] -> LazySegTree a
fromList xs = fl n xs
    where n = length xs

fl :: Int -> [a] -> LazySegTree a
fl n [x] = Leaf x
fl n xs = Tree n leftT rightT True
    where n' = n `div` 2
          (xsL, xsR) = splitAt n' xs
          leftT = fl n' xsL
          rightT = fl (n-n') xsR

updateT :: LazySegTree a -> Int -> Int -> a -> LazySegTree a
updateT (Leaf a) _ _ x = Leaf x
updateT tr s t x
  | isElem tr = elemUpdateT tr s t x
  | n <= s = tr { lazy = False, right = updateT (right tr) (s-n) (t-n) x }
  | n > t  = tr { lazy = False, left = updateT (left tr) s t x }
  | t-s+1 == size tr = Elem (size tr) x
  | otherwise = tr { lazy = False
                   , left = updateT (left tr) s (n-1) x
                   , right = updateT (right tr) 0 (t-n) x
                   }
    where n = size tr `div` 2

elemUpdateT tr s t x
  | eSize tr == 1 = Leaf x
  | n <= s = Tree { size = eSize tr, lazy = False, left = lt, right = elemUpdateT rt (s-n) (t-n) x}
  | n > t = Tree { size = eSize tr, lazy = False, left = elemUpdateT lt s t x, right = rt }
  | t - s + 1 == eSize tr = tr { elem = x }
  | otherwise = Tree { lazy = False
                     , left = elemUpdateT lt s (n-1) x
                     , right = elemUpdateT rt 0 (t-n) x
                     , size = eSize tr
                     }
    where n = eSize tr `div` 2
          lt = Elem n (elem tr)
          rt = Elem (eSize tr - n) (elem tr)

findT (Leaf x) 0 = x
findT tr i
  | isElem tr = elem tr
  | n <= i = findT (right tr) (i-n)
  | n > i = findT (left tr) i
    where n = size tr `div` 2

