#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <deque>
#include <functional>
#include <initializer_list>
#include <math.h>
#include <map>
#include <random>
#include <set>
#include <stack>
#include <tuple>
#include <type_traits>
#include <queue>
#include <vector>


using lli = long long int;
using pii = std::pair<int, int>;

// グリッド上の縦横移動
constexpr std::array<std::pair<int, int>, 4> dxdy = {
    { {1, 0}, {-1, 0}, {0, 1}, {0, -1} }
};


template <typename T> inline bool chmin(T& a, T b){ if(b < a){ a = b; return true; } return false; }
template <typename T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }

inline bool isIn(int x, int y, int H, int W){return 0 <= x and x < H and 0 <= y and y < W;}
inline auto isInTheGrid(const int H, const int W){
    return std::bind(isIn, std::placeholders::_1, std::placeholders::_2, H, W);
}
inline bool bitUP(int state, int k){ return (state >> k) & 1; }
inline bool bitUP(long long int state, int k){ return (state >> k) & 1;}


namespace MyInputAndOutput{
    // 入力関係 (cin)
    class user_input{
    public:
        inline const user_input& operator >> (int& int_arg) const {
            scanf("%d", &int_arg); return *this;
        }
        inline const user_input& operator >> (long long int& llint_arg) const {
            scanf("%lld", &llint_arg); return *this;
        }
        inline const user_input& operator >> (unsigned int& uint_arg) const {
            scanf("%u", &uint_arg); return *this;
        }
        inline const user_input& operator >> (unsigned long long int& ullint_arg) const {
            scanf("%llu", &ullint_arg); return *this;
        }
        inline const user_input& operator >> (unsigned long& ullint_arg) const {
            scanf("%lu", &ullint_arg); return *this;
        }
        inline const user_input& operator >> (char* str_arg) const {
            scanf("%s", str_arg); return *this;
        }
        inline const user_input& operator >> (char& char_arg) const {
            scanf("%*c%c", &char_arg); return *this;
        }
        template <typename S, typename T>
        inline const user_input& operator >>(std::pair<S, T>& pair_arg) const{
            (*this) >> pair_arg.first >> pair_arg.second; return *this;
        }
        template <typename T>
        inline const user_input& operator >>(std::vector<T>& vec) const {
            for(T& ele : vec) (*this) >> ele; return *this;
        }
    } cin;

    // 出力関係 (cout)
    class user_output{
    public:
        user_output(void){}
        inline const user_output& operator << (const int int_arg) const{
            printf("%d", int_arg); return *this;
        }
        inline const user_output& operator << (const unsigned int uint_arg) const{
            printf("%u", uint_arg); return *this;
        }
        inline const user_output& operator << (const long long int llint_arg) const {
            printf("%lld", llint_arg); return *this;
        }
        inline const user_output& operator << (const unsigned long long int ullint_arg) const {
            printf("%llu", ullint_arg); return *this;
        }
        inline const user_output& operator << (const unsigned long ulint_arg) const {
            printf("%lu", ulint_arg); return *this;
        }
        inline const user_output& operator << (const double ld_arg) const {
            printf("%.16lf", ld_arg); return *this;
        }
        inline const user_output& operator << (const long double ld_arg) const {
            printf("%.16Lf", ld_arg); return *this;
        }
        inline const user_output& operator << (const char char_arg) const {
            putchar(char_arg); return *this;
        }
        inline const user_output& operator << (const unsigned char uchar_arg) const {
            putchar(uchar_arg); return *this;
        }
        inline const user_output& operator << (const char* str_arg) const {
            fputs(str_arg, stdout); return *this;
        }
        template <typename S, typename T>
        inline const user_output& operator <<(const std::pair<S, T>& pair_arg) const{
            (*this) << pair_arg.first << ' ' << pair_arg.second; return *this;
        }
        template <typename Tp_name>
        inline const user_output& operator << (const std::vector<Tp_name>& vec) const {
            const size_t size_of_vec = vec.size();
            if(size_of_vec <= 0) return *this;
            (*this) << vec[0]; 
            for(size_t index = 1; index < size_of_vec; ++index) (*this) << ' ' << vec[index];
            return *this;
        }
    } cout;

    // その他出力関数
    void binary_output(int64_t value, size_t length = 64){
        char out[length + 1];
        for(size_t i = 0; i < length; ++i) out[length - 1 - i] = ((value >> i) & 1) ? '1' : '0';
        out[length] = '\0'; puts(out);
    }
    template <typename InputType>
    void print(InputType first, InputType last, const char separate_c = ' ', const char end_c = '\n'){
        InputType it = first;
        while(true){
            MyInputAndOutput::cout << *it;
            if(++it == last){MyInputAndOutput::cout << end_c; return;}
            MyInputAndOutput::cout << separate_c;  
        }
    }
}; namespace MIO = MyInputAndOutput;

// z-algorithm
template <class T> std::vector<int> z_algorithm(const T &str) {
    const size_t n = str.size();
    std::vector<int> resOfCP(n); resOfCP[0] = n;
    int i = 1, j = 0;
    while (i < n) {
        while (i + j < n and str[j] == str[i + j]) ++j;
        resOfCP[i] = j;
        if (j == 0) { ++i; continue;}
        int k = 1;
        while (i + k < n and k + resOfCP[k] < j) resOfCP[i + k] = resOfCP[k], ++k;
        i += k; j -= k;
    }
    return resOfCP;
} 



// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


struct seg_monoid{
    using element_type  = int;
    using operator_type = int;

    struct element_structure{
        static constexpr element_type id = INT32_MAX;
        constexpr element_type operator() (element_type lhs, element_type rhs){  
        return lhs > rhs ? rhs : lhs;
        }
    };

    struct operator_structure{
        static constexpr operator_type id = INT32_MIN;     
        constexpr operator_type operator() (operator_type lhs, operator_type rhs){ 
            return rhs == id ? lhs : rhs;
        }
    };

    constexpr element_type operator()(element_type lhs, operator_type rhs){
        return rhs == operator_structure::id ? lhs : rhs;
    }
};

template <class seg_structure>
class lazy_segment_tree{
private:
    using element_t    = typename seg_structure::element_type;
    using operator_t   = typename seg_structure::operator_type;
    using ele_struct_t = typename seg_structure::element_structure;
    using ope_struct_t = typename seg_structure::operator_structure;

    size_t length;
    size_t height;
    std::vector<element_t>   data;
    std::vector<operator_t>  lazy;

    // lazy[idx] の情報を子ノードに伝搬する → dataの更新を行う
    void eval(size_t idx){
        if(lazy[idx] == ope_struct_t::id) return;
        if(idx < length){ 
            lazy[2 * idx    ] = ope_struct_t()(lazy[2 * idx],     lazy[idx]);
            lazy[2 * idx + 1] = ope_struct_t()(lazy[2 * idx + 1], lazy[idx]);
        }
        data[idx] = seg_structure()(data[idx], lazy[idx]);
        lazy[idx] = ope_struct_t::id;
    }

    // 遅延評価から
    void calculateData(size_t idx) {
        while((idx /= 2) > 0) data[idx] = ele_struct_t()(reflect(2 * idx), reflect(2 * idx + 1));
    }

    // 遅延評価を考慮した値を返す
    element_t reflect(size_t idx){
        if(lazy[idx] == ope_struct_t::id) return data[idx];
        return seg_structure()(data[idx], lazy[idx]);
    }

public:
    lazy_segment_tree(size_t N){
        height = 0; length = 1; 
        while(length < N) length *= 2, height++;
        data.assign(2 * length, (element_t)(ele_struct_t::id));
        lazy.assign(2 * length, (operator_t)(ope_struct_t::id));
    }
    lazy_segment_tree(const std::vector<element_t>& A){
        const size_t n = A.size();
        height = 0; length = 1; 
        while(length < n) length *= 2, height++;
        data.resize(2 * length);
        for(int i = 0; i < n; ++i) data[i + length] = A[i];
        for(int i = n; i < length; ++i) data[i + length] = ele_struct_t::id;
        for(int i = length - 1; i >= 0; --i) data[i] = ele_struct_t()(data[2 * i], data[2 * i + 1]);
        lazy.assign(2 * length, (operator_t)(ope_struct_t::id));
    }

    void update(int left, int right, const operator_t& op){
        if(left >= right) return;

        size_t l = left + length;      for(size_t i = height; i > 0; --i) eval(l >> i);
        size_t r = right + length - 1; for(size_t i = height; i > 0; --i) eval(r >> i);

        for(size_t ll = l, rr = r + 1; ll < rr; ll /= 2, rr /= 2){
            if(ll % 2 == 1){
                lazy[ll] = ope_struct_t()(lazy[ll], op); ++ll;
            }
            if(rr % 2 == 1){
                --rr; lazy[rr] = ope_struct_t()(lazy[rr], op);
            }
        }

        calculateData(l); calculateData(r);
    }

    // 区間 [left, right) (0-indexed) の値を求める
    inline element_t query(size_t left, size_t right){
        if(left >= right) return ele_struct_t::id;
        // ボトムアップに伝搬を伝える
        size_t l = left + length;      for(size_t i = height; i > 0; --i) eval(l >> i);
        size_t r = right + length - 1; for(size_t i = height; i > 0; --i) eval(r >> i);

        element_t vl = ele_struct_t::id, vr = ele_struct_t::id;
        for(size_t ll = l, rr = r + 1; ll < rr; ll /= 2, rr /= 2) {
            if (ll % 2 == 1) {
                vl = ele_struct_t()(vl, seg_structure()(data[ll], lazy[ll])); ++ll;
            }
            if (rr % 2 == 1) {
                --rr; vr = ele_struct_t()(seg_structure()(data[rr], lazy[rr]), vr);
            }
        }
        return ele_struct_t()(vl, vr);
    }
};

using RmQ = lazy_segment_tree<seg_monoid>;

int main(void){
    int n, q; MIO::cin >> n >> q;
    RmQ Tree(n);
    for(int _ = 0; _ < q; ++_){
        char c; int l, r; MIO::cin >> c >> l >> r; r++;
        if(c == '0'){
            int x; MIO::cin >> x; Tree.update(l, r, x);
        }
        else{
            MIO::cout << Tree.query(l, r) << '\n';
        }
    }
    return 0;
}


Measured memory_bytes: 4952