#include<iostream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

typedef unsigned long long ull;

const ull INF = ULLONG_MAX/3;

void latentEvaluation(int ss, vector<ull> &xList, vector<ull> &sxList, vector<ull> &smList){
    int sn = sxList.size();
    if(sxList[ss] != INF){
        for(int i=0;i<sn;i++){
            xList[sn*ss+i] = sxList[ss];
        }
        smList[ss] = sxList[ss];
        sxList[ss] = INF;
    }
    return;
}

void updateMinimum(int ss, vector<ull> &xList, vector<ull> &smList){
    int sn = smList.size();
    ull m = INF;
    for (int i=0;i<sn;i++){
        m = min(m, xList[ss*sn + i]);
    }
    smList[ss] = m;
    return;
}

void update(int s, int t, ull x, vector<ull> &xList, vector<ull> &sxList, vector<ull> &smList){
    int nn = xList.size();
    int sn = sxList.size();
    int ss = s/sn;
    int tt = t/sn;
    if(ss == tt){
        latentEvaluation(ss, xList, sxList, smList);
        for (int i=0;i<t-s+1;i++){
            xList[s+i] = x;
        }
        updateMinimum(ss, xList, smList);
    }else{
        latentEvaluation(ss, xList, sxList, smList);
        for(int i=s;i<(ss+1)*sn;i++){
            xList[i] = x;
        }
        updateMinimum(ss, xList, smList);

        latentEvaluation(tt, xList, sxList, smList);
        for(int i=tt*sn;i<t+1;i++){
            xList[i] = x;
        }
        updateMinimum(tt, xList, smList);

        for(int i=ss+1;i<tt;i++){
            sxList[i] = x;
            smList[i] = x;
        }
    }
}

void find(int s,int t, vector<ull> &xList, vector<ull> &sxList, vector<ull> &smList){
    int nn = xList.size();
    int sn = sxList.size();
    int ss = s/sn;
    int tt = t/sn;
    ull m = INF;

    if(ss==tt){
        latentEvaluation(ss, xList, sxList, smList);
        for (int i=s;i<t+1;i++){
            m = min(m,xList[i]);
        }
        cout << m << endl;
    }else{
        latentEvaluation(ss, xList, sxList, smList);
        for(int i=s;i<(ss+1)*sn;i++){
            m = min(xList[i], m);
        }

        latentEvaluation(tt, xList, sxList, smList);
        for(int i=tt*sn;i<t+1;i++){
            m = min(xList[i],m);
        }

        for(int i=ss+1;i<tt;i++){
            m = min(smList[i],m);
        }
        cout << m << endl;
    }
}

int main(){
    int n, q, qType, s, t,ind;
    ull x;
    cin >> n >> q;
    int sn = sqrt(n)+1;

    vector<ull> xList(sn*sn, (1ull << 31) -1);
    vector<ull> sxList(sn, INF);
    vector<ull> smList(sn, (1ull << 31) -1);

    for (int i=0;i<q;i++){
        cin >> qType;
        if (qType == 0){
            cin >> s >> t >> x;
            update(s,t,x,xList,sxList, smList);
        }else{
            cin >> s >> t;
            find(s,t,xList, sxList,smList);
        }
/*
        for (int i=0;i<sn*sn;i++){
            cout << xList[i]  << " ";
        }
        cout << endl;
        for (int i=0;i<sn;i++){
            cout << sxList[i] << " ";
        }
        cout << endl;
        for (int i=0;i<sn;i++){
            cout << smList[i] << " ";
        }
        cout << endl;
*/
    }
    return 0;
}

Measured memory_bytes: 3636