//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vi a(n, INT_MAX);
    int m = sqrt(n);
    vi b((n+m-1)/m, INT_MAX), c((n+m-1)/m, -1);

    auto update = [&](int s, int t, int x) {
        if(s/m == t/m) {
            if(c[s/m] != -1) {
                for(int i = s/m*m; i != (s/m+1)*m and i != n; i++) a[i] = c[s/m];
                c[s/m] = -1;
            }
            for(; s != t; a[s++] = x);
            b[s/m] = INT_MAX;
            for(int i = s/m*m; i != (s/m+1)*m and i != n; chmin(b[s/m], a[i++]));
        } else {
            if(c[s/m] != -1) {
                for(int i = s/m*m; i != (s/m+1)*m; i++) a[i] = c[s/m];
                c[s/m] = -1;
            }
            if(c[t/m] != -1) {
                for(int i = t/m*m; i != (t/m+1)*m and i != n; i++) a[i] = c[t/m];
                c[t/m] = -1;
            }
            if(s%m) {
                for(; s%m; a[s++] = x);
                b[s/m-1] = INT_MAX;
                for(int i = (s/m-1)*m; i != s/m*m and i != n; chmin(b[s/m-1], a[i++]));
            }
            if(t%m) {
                for(; t%m; a[--t] = x);
                b[t/m] = INT_MAX;
                for(int i = t/m*m; i != (t/m+1)*m and i != n; chmin(b[t/m], a[i++]));
            }
            for(s /= m, t /= m; s != t; s++) {
                b[s] = c[s] = x;
            }
        }
    };
    auto find = [&](int s, int t) {
        if(s/m == t/m) {
            if(c[s/m] != -1) {
                return c[s/m];
            }
            int res = INT_MAX;
            for(; s != t; chmin(res, a[s++]));
            return res;
        } else {
            int res = INT_MAX;
            if(c[s/m] != -1) {
                for(int i = s/m*m; i != (s/m+1)*m; a[i++] = c[s/m]);
                c[s/m] = -1;
            }
            for(; s%m; chmin(res, a[s++]));
            if(c[t/m] != -1) {
                for(int i = t/m*m; i != (t/m+1)*m and i != n; a[i++] = c[t/m]);
                c[t/m] = -1;
            }
            for(; t%m; chmin(res, a[--t]));
            for(s /= m, t /= m; s != t; chmin(res, b[s++]));
            return res;
        }
    };

    while(q--) {
        int t;
        cin >> t;
        if(t) {
            int s, t;
            cin >> s >> t;
            cout << find(s, t+1) << '\n';
        } else {
            int s, t, x;
            cin >> s >> t >> x;
            update(s, t+1, x);
        }
    }
}


Measured memory_bytes: 3352