#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;



template<typename Monoid, typename Operand>
class lazy_segment_tree {
	struct node {
		Monoid element;
		Operand lazy;
	};
	std::vector<node> tree;
	uint32 size, height;
	void push(uint32 index) {
		tree[index << 1].lazy = tree[index << 1].lazy*tree[index].lazy;
		tree[index << 1 | 1].lazy = tree[index << 1 | 1].lazy*tree[index].lazy;
		tree[index].element = tree[index].element*tree[index].lazy;
		tree[index].lazy.inactive();
		return;
	}
	void recalc(uint32 index) {
		tree[index].element = (tree[index << 1].element*tree[index << 1].lazy) + (tree[index << 1 | 1].element*tree[index << 1 | 1].lazy);
	}
public:
	lazy_segment_tree(uint32 length) :height(static_cast<uint32>(0)) {
		--length;
		length |= length >> 1;
		length |= length >> 2;
		length |= length >> 4;
		length |= length >> 8;
		length |= length >> 16;
		if (!length) length = 1;
		height = __builtin_popcount(length);
		size = length + 1;
		tree = std::vector<node>(size << 1);
	}
	void set(void) {
		uint32 const s = size;
		uint32 i = s << 1;
		while (--i >= s) {
			tree[i].element.set();
			tree[i].lazy.inactive();
		}
		do {
			tree[i].element = tree[i << 1].element + tree[i << 1 | 1].element;
			tree[i].lazy.inactive();
		} while (--i);
		return;
	}

	void update(uint32 begin, uint32 end, const Operand &data) {
		begin += size;
		end += size - 1;
		uint32 i = height;
		do {
			push(begin >> i);
			push(end >> i);
		} while (--i);
		for (uint32 left = begin, right = end + 1;left < right;left >>= 1, right >>= 1) {
			if (left & 1) {
				tree[left].lazy = tree[left].lazy * data;
				++left;
			}
			if (right & 1) {
				--right;
				tree[right].lazy = tree[right].lazy * data;
			}
		}
		i = height;
		do {
			recalc(begin >>= 1);
			recalc(end >>= 1);
		} while (--i);
		return;
	}
	Monoid range(uint32 begin, uint32 end) {
		Monoid retL, retR;
		begin += size;end += size - 1;
		uint32 i = height;
		do {
			push(begin >> i);
			push(end >> i);
		} while (--i);
		++end;
		for (;begin < end;(++begin) >>= 1, end >>= 1) {
			if (begin & 1) {
				retL = retL + (tree[begin].element * tree[begin].lazy);
			}
			if (end & 1) {
				retR = (tree[end - 1].element * tree[end - 1].lazy) + retR;
			}
		}
		return retL + retR;
	}
};

struct ADD {
	int64 e;
	ADD(int64 x = 0) { e = x; }
	void inactive() { e = 0; }
	ADD operator*(const ADD &other) {
		return ADD(e + other.e);
	}
};
struct SUB {
	int32 e;
	bool a;
	SUB() { inactive(); }
	SUB(int32 x, bool y = 1) { e = x; a = y; }
	void inactive(void) {
		a = false;
	}
	SUB operator*(const SUB &other) {
		if (other.a) return other;
		return *this;
	}
};
struct MIN {
	int32 e;
	MIN(int32 x = ((int32)1 << 31) - 1) { e = x; }
	void set() { e = std::numeric_limits<int32>::max(); }
	void reverse(void) {}
	MIN operator+(const MIN &other) {
		if (e < other.e) return *this;
		return other;
	};
	MIN operator*(const SUB &other) {
		if (other.a) return MIN(other.e);
		return *this;
	}
};

int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint32 n, q;
	std::cin >> n >> q;
	lazy_segment_tree<MIN,SUB> T(n);
	int64 c, s, t, x;
	do {
		std::cin >> c >> s >> t;
		if (c) {
			std::cout << T.range(s, t+1).e << "\n";
		}
		else {
			std::cin >> x;
			T.update(s, t+1, SUB(x));
		}
	} while (--q);
	return 0;
}


Measured memory_bytes: 8856