import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons;
import std.math, std.numeric;

void main() {
    int n, q; scan(n, q);
    auto sd = SqrtDecomp(n);
    foreach (_ ; 0 .. q) {
        auto line = readln.split.to!(int[]);
        if (line[0] == 0) {
            sd.update(line[1], line[2] + 1, line[3]);
        }
        else {
            writeln(sd.getMin(line[1], line[2] + 1));
        }
        debug {
            sd.data.writeln;
            sd.bucketMin.writeln;
            sd.bucketChange.writeln;
        }
    }
}


struct SqrtDecomp {
    enum root = 512;
    int K, N;
    int[] bucketMin;
    int[] bucketChange;
    int[] data;

    this(int n) {
        K = (n + root - 1) / root;
        N = K * root;
        bucketMin = new int[](K);
        bucketChange = new int[](K);
        data = new int[](K * root);
        bucketMin[] = int.max;
        bucketChange[] = -1;
        data[] = int.max;
    }

    void update(int s, int t, int x) {
        foreach (k ; 0 .. K) {
            int lb = k * root, rb = (k + 1) * root;
            if (t <= lb || rb <= s) continue;
            if (s <= lb && rb <= t) {
                bucketChange[k] = x;
                bucketMin[k] = x;
            }
            else {
                bucketMin[k] = int.max;
                foreach (i ; lb .. rb) {
                    if (bucketChange[k] != -1) {
                        data[i] = bucketChange[k];
                    }
                    if (s <= i && i < t) {
                        data[i] = x;
                    }
                    bucketMin[k] = min(bucketMin[k], data[i]);
                }
                bucketChange[k] = -1;
            }
        }
    }

    int getMin(int s, int t) {
        int res = int.max;
        foreach (k ; 0 .. K) {
            int lb = k * root, rb = (k + 1) * root;
            if (t <= lb || rb <= s) continue;
            if (s <= lb && rb <= t) {
                res = min(res, bucketMin[k]);
            }
            else {
                foreach (i ; lb .. rb) {
                    if (bucketChange[k] != -1) {
                        data[i] = bucketChange[k];
                    }
                    if (s <= i && i < t) {
                        res = min(res, data[i]);
                    }
                }
                bucketChange[k] = -1;
            }
        }
        return res;
    }
}


void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

