#line 1 "test/aoj/DSL2F.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_F"
#include <iostream>
#include <algorithm>
#line 1 "segment_tree/lazy_segment_tree.hpp"



#include <vector>
#include <cstdint>
#line 1 "bit/msb.hpp"



#line 5 "bit/msb.hpp"

inline int msb32(uint32_t x) {
        if (x == 0) return -1;
#ifndef __has_builtin
        int r = 0;
        if (x >> 16) x >>= 16, r |= 16;
        if (x >> 8) x >>= 8, r |= 8;
        if (x >> 4) x >>= 4, r |= 4;
        if (x >> 2) x >>= 2, r |= 2;
        return r | (x >> 1);
#else
        return 31 - __builtin_clz(x);
#endif
};

inline int msb64(uint64_t x) {
    if (x == 0) return -1;

    #ifndef __has_builtin
        int r = 0;
        if (x >> 32) x >>= 32, r |= 32;
        if (x >> 16) x >>= 16, r |= 16;
        if (x >> 8) x >>= 8, r |= 8;
        if (x >> 4) x >>= 4, r |= 4;
        if (x >> 2) x >>= 2, r |= 2;
        return r | (x >> 1);
#else
    return 63 - __builtin_clzll(x);
#endif
};


#line 7 "segment_tree/lazy_segment_tree.hpp"

//===
template<class MonoidwithOperator>
struct LazySegmentTree {
    using M = MonoidwithOperator;
    using V = typename M::value_structure;
    using T = typename V::value_type;
    using O = typename M::operator_structure;
    using E = typename O::value_type;

    // mergeMonoid V::operation
    // applyOperator M::operation
    // mergeOperator O::operation

    struct Node {
        T dat;
        E lazy;
        Node (T dat, E lazy): dat(dat), lazy(lazy) {};
    };

    std::vector<Node> tree;

    LazySegmentTree() = default;
    explicit LazySegmentTree(uint32_t n):
        tree(n * 2 + 2, Node(V::identity(), O::identity())) {};

    int size() {
        return tree.size() >> 1;
    };
    
    void propagation(uint32_t k) {
        const uint32_t l = (k << 1) | 0;
        const uint32_t r = (k << 1) | 1;
        tree[l].lazy = O::operation(tree[l].lazy, tree[k].lazy);
        tree[r].lazy = O::operation(tree[r].lazy, tree[k].lazy);
        tree[l].dat = M::operation(tree[l].dat, tree[k].lazy);
        tree[r].dat = M::operation(tree[r].dat, tree[k].lazy);
        tree[k].lazy = O::identity();
    };
    void push_down(uint32_t k) {
        if (k == 0) return;
        uint32_t w = msb32(k);
        for (int i = w; i > 0; i--) propagation(k >> i);
    };
    void recalc(uint32_t k) {
        while (k > 1) {
            k >>= 1;
            tree[k].dat = V::operation(tree[(k << 1) | 0].dat,
                                       tree[(k << 1) | 1].dat);
        }
    };
    
    // [l, r) += op
    void update(uint32_t l, uint32_t r, E op) {
        l += size();
        r += size();
        uint32_t tmpl = l;
        uint32_t tmpr = r;
        push_down(l);
        push_down(r - 1);

        while (l < r) {
            if (l & 1) {
                tree[l].lazy = O::operation(tree[l].lazy, op);
                tree[l].dat = M::operation(tree[l].dat, op);
                l++;
            }
            if (r & 1) {
                --r;
                tree[r].lazy = O::operation(tree[r].lazy, op);
                tree[r].dat = M::operation(tree[r].dat, op);
            }
            l >>= 1;
            r >>= 1;
        }

        push_down(tmpl);
        push_down(tmpr - 1);
        recalc(tmpl);
        recalc(tmpr - 1);
    };
    void update(uint32_t idx, T x) {
        idx += size();
        push_down(idx);
        tree[idx].dat = x;
        recalc(idx);
    };
    void set(uint32_t idx, T x) {
        update(idx, x);
    };

    // foldl[l, r)
    T fold(uint32_t l, uint32_t r) {
        l += size();
        r += size();
        push_down(l);
        push_down(r - 1);

        T lv = V::identity();
        T rv = V::identity();

        while (l < r) {
            if (l & 1) lv = V::operation(lv, tree[l].dat), l++;
            if (r & 1) --r, rv = V::operation(tree[r].dat, rv);

            l >>= 1;
            r >>= 1;
        }

        return V::operation(lv, rv);
    };

    T operator [](const uint32_t &k) {
        push_down(k + size());
        return tree[k + size()].dat;
    };
};
//===


#line 5 "test/aoj/DSL2F.test.cpp"
using namespace std;
using llong = long long;

struct M {
    struct Monoid {
        using T = llong;
        using value_type = T;

        inline static T identity() {
            return (1ll << 31) - 1;
        };
        inline static T operation(T a, T b) {
            return min(a, b);
        };
    };
    struct Operator {
        using E = llong;
        using value_type = E;

        inline static E identity() {
            return (1ll << 31) - 1;
        };
        inline static E operation(E a, E b) {
            if (a == identity()) return b;
            else if (b == identity()) return a;
            else return b;
        };
    };

    using value_structure = Monoid;
    using operator_structure = Operator;
    using T = typename Monoid::T;
    using E = typename Operator::E;

    inline static T operation(T dat, E op) {
        if (op == operator_structure::identity()) return dat;
        else return op;
    };
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    llong n, q;
    llong com, s, t, x;

    cin >> n >> q;

    LazySegmentTree<M> seg(n);

    for (int i = 0; i < q; i++) {

        cin >> com;

        if (com == 0) {
            cin >> s >> t >> x;
            seg.update(s, t + 1, x);
        }
        else if (com == 1) {
            cin >> s >> t;
            cout << seg.fold(s, t + 1) << endl;
        }

    }

    return 0;
}



Measured memory_bytes: 5984