#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;
		bool h;
		node():h(0){}
	};
	std::vector<node> tree;
	uint32 size, height;
	void recalc(uint32 index) {
		tree[index].element = (tree[index << 1].h ? tree[index << 1].element*tree[index << 1].lazy : tree[index << 1].element)
			+ (tree[index << 1 | 1].h ? tree[index << 1 | 1].element*tree[index << 1 | 1].lazy : tree[index << 1 | 1].element);
	}
	void push(uint32 index) {
		if (tree[index << 1].h) {
			tree[index << 1].lazy = tree[index << 1].lazy*tree[index].lazy;
		}
		else {
			tree[index << 1].lazy = tree[index].lazy;
			tree[index << 1].h = 1;
		}
		if (tree[index << 1 | 1].h) {
			tree[index << 1 | 1].lazy = tree[index << 1 | 1].lazy*tree[index].lazy;
		}
		else {
			tree[index << 1 | 1].lazy = tree[index].lazy;
			tree[index << 1 | 1].h = 1;
		}
		tree[index].element = tree[index].element*tree[index].lazy;
		tree[index].h = 0;
		return;
	}
public:
	void update(uint32 begin, uint32 end, const Operand &data) {
		begin += size;
		end += size - 1;
		uint32 i = height;
		do {
			if (tree[begin >> i].h)push(begin >> i);
			if (tree[end >> i].h)push(end >> i);
		} while (--i);
		for (uint32 left = begin, right = end + 1;left < right;left >>= 1, right >>= 1) {
			if (left & 1) {
				if (tree[left].h) {
					tree[left].lazy = tree[left].lazy * data;
				}
				else {
					tree[left].lazy = data;
					tree[left].h = 1;
				}
				++left;
			}
			if (right & 1) {
				--right;
				if (tree[right].h) {
					tree[right].lazy = tree[right].lazy * data;
				}
				else {
					tree[right].lazy = data;
					tree[right].h = 1;
				}
			}
		}
		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 {
			if (tree[begin >> i].h)push(begin >> i);
			if (tree[end >> i].h)push(end >> i);
		} while (--i);
		++end;
		for (;begin < end;(++begin) >>= 1, end >>= 1) {
			if (begin & 1) {
				retL = retL + (tree[begin].h ? tree[begin].element * tree[begin].lazy : tree[begin].element);
			}
			if (end & 1) {
				retR = (tree[--end].h ? tree[end].element * tree[end].lazy : tree[end].element) + retR;
			}
		}
		return retL + retR;
	}
	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].h = 0;
		}
		do {
			tree[i].element = tree[i << 1].element + tree[i << 1 | 1].element;
			tree[i].h = 0;
		} while (--i);
		return;
	}
};
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 MIN &other) {
		return other;
	}
};

int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint32 n, q;
	std::cin >> n >> q;
	lazy_segment_tree<MIN, MIN> T(n);
	uint32 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, MIN(x));
		}
	} while (--q);
	return 0;
}


Measured memory_bytes: 8884