// ******************************************************************
// Segment Tree with Lazy Propagation
// Assignment modification on range, queries for sum on range.
// ******************************************************************

#include <bits/stdc++.h>
using namespace std;

template<typename T>
class SegTreeLazy{
    size_t n;
    int h;
    vector<T> data;     // data[i]: ??????i ????????§???/????°????
    vector<T> lazy;     // lazy[i]: ??????i ????????????????????????????????????
    vector<bool> used;  // used[i]: lazy[i] ???????????§??????????????????(???????????????????????¨??? true???
    //const T identity_element = numeric_limits<T>::min();  // for max
    const T identity_element = numeric_limits<T>::max();  // for min
    static T combine(T L, T R){
        //return max(L, R);
        return min(L, R);
    }
    void apply(size_t i, T v){
        data[i] = v;
        lazy[i] = v;
        used[i] = true;
    }
    void build(size_t i){      // update all the parents of node i.
        while (i > 1){
            i >>= 1;
            if (not used[i]) data[i] = combine(data[i*2], data[i*2+1]);
        }
    }
    void push(size_t p){       // propagates the changes from the root to node p.
        for (int s = h; s > 0; --s){
            size_t i = p >> s;
            if (used[i]){
                apply(i*2, lazy[i]);
                apply(i*2+1, lazy[i]);
                used[i] = false;
            }
        }
    }
    int calc_h(size_t nn){
        int hh = 1;
        for (; nn > 1; ++hh, nn >>= 1);
        return hh;
    }
public:
    SegTreeLazy(size_t _n): n(_n), h(calc_h(n)), data(2 * n, 0), lazy(2 * n, 0), used(2 * n, false) {
        for (int i = 0; i < n; ++i) apply(n + i, identity_element);
        for (int i = n - 1; i > 0; --i) data[i] = combine(data[i*2], data[i*2+1]);
    }
    SegTreeLazy(const vector<T> &src): n(src.size()), h(calc_h(n)), data(2 * n, 0), lazy(2 * n, 0), used(2 * n, false){
        for (int i = 0; i < n; ++i) apply(n + i, src[i]);
        for (int i = n - 1; i > 0; --i) data[i] = combine(data[i*2], data[i*2+1]);
    }
    void modify(size_t L, size_t R, T v){  // assign v to range [L, R)
        L += n;
        R += n;
        size_t L0 = L;
        size_t R0 = R;
        push(L);
        push(R - 1);
        for (; L < R; L >>= 1, R >>= 1){
            if (L & 1) apply(L++, v);
            if (R & 1) apply(--R, v);
        }
        build(L0);
        build(R0 - 1);
    }
    T query(size_t L, size_t R){
        L += n;
        R += n;
        push(L);
        push(R - 1);
        T ret = identity_element;
        for (; L < R; L >>= 1, R >>= 1){
            if (L & 1) ret = combine(ret, data[L++]);
            if (R & 1) ret = combine(data[--R], ret);
        }
        return ret;
    }
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    SegTreeLazy<int> seg(n);
    while (q--){
        int c;
        cin >> c;
        if (c == 0){
            int s, t, x;
            cin >> s >> t >> x;
            seg.modify(s, t + 1, x);
        }else{
            int s, t;
            cin >> s >> t;
            cout << seg.query(s, t + 1) << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 4644