#include <bits/stdc++.h>
using namespace std;

class LazySegmentTree {
	const int n;
	const int flag = -1;
	const int id = INT_MAX;
	vector<int> data, data2;
	int size(int n) {
		int res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	int sub(int l, int r, int node, int lb, int ub) {
		if (ub <= l || r <= lb) return id;
		if (data[node] != flag) {
			return data[node];
		}
		if (l <= lb && ub <= r) {
			return data[node] == flag ? data2[node] : data[node];
		}
		int left = node * 2, right = node * 2 + 1;
		if (data[node] != flag) {
			data[left] = data[node];
			data[right] = data[node];
		}
		return min(sub(l, r, node * 2, lb, (lb + ub) / 2), sub(l, r, node * 2 + 1, (lb + ub) / 2, ub));
	}
	void suc(int l, int r, int node, int lb, int ub, int val) {
		if (ub <= l || r <= lb) return;
		if (data[node] == val) return;
		if (l <= lb && ub <= r) {
			data[node] = val;
			return;
		}
		int left = node * 2, right = node * 2 + 1;
		if (data[node] != flag) {
			data[left] = data[node];
			data[right] = data[node];
		}
		data[node] = flag;
		suc(l, r, left, lb, (lb + ub) / 2, val);
		suc(l, r, right, (lb + ub) / 2, ub, val);
		data2[node] = min(data[left] == flag ? data2[left] : data[left], data[right] == flag ? data2[right] : data[right]);
	}
public:
	LazySegmentTree(int n_) :
		n(size(n_)), data(n * 2, id), data2(n * 2, id) {}
	void update(int l, int r, int val) {
		suc(l, r + 1, 1, 0, n, val);
	}
	int find(int l, int r) {
		return sub(l, r + 1, 1, 0, n);
	}
};

int main()
{
	int n, q, b, s, t, x;
	cin >> n >> q;
	LazySegmentTree lst(n);
	while (q--) {
		cin >> b;
		if (b) {
			cin >> s >> t;
			cout << lst.find(s, t) << endl;
		}
		else {
			cin >> s >> t >> x;
			lst.update(s, t, x);
		}
	}
	return 0;
}