Problem: Write a program which manipulates a sequence A = {a0, a1, . . . , an−1} with the following operations:

* update(s, t, x): change as, as+1, ..., at to x.
* find(s, t): report the minimum element in as, as+1, ..., at.



Note that the initial values of ai (i = 0, 1, . . . , n−1) are 231-1.

Constraints

* 1 ≤ n ≤ 100000
* 1 ≤ q ≤ 100000
* 0 ≤ s ≤ t < n
* 0 ≤ x < 231−1

Input


n q
query1
query2
:
queryq


In the first line, n (the number of elements in A) and q (the number of queries) are given. Then, ith query queryi is given in the following format:


0 s t x


or


1 s t


The first digit represents the type of the query. '0' denotes update(s, t, x) and '1' denotes find(s, t).

Output

For each find operation, print the minimum value.

Examples

Input

3 5
0 0 1 1
0 1 2 3
0 2 2 2
1 0 2
1 1 2


Output

1
2


Input

1 3
1 0 0
0 0 0 5
1 0 0


Output

2147483647
5

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

template<typename T>
struct LazySegTree {
	vector<T> node, lazy;
	vector<bool> done;
	int n;
	T init_val;
	
	LazySegTree(int _n, T init_val) : init_val(init_val) {
		n = 1;
		while (n < _n) n *= 2;
		node.resize(n * 2 - 1, init_val);
		lazy.resize(n * 2 - 1);
		done.resize(n * 2 - 1, true);
	}
	
	void eval(int k, int l, int r) {
		if (done[k]) return;
		node[k] = lazy[k];
		
		if (r - l > 1) {
			lazy[k * 2 + 1] = lazy[k]; done[k * 2 + 1] = false;
			lazy[k * 2 + 2] = lazy[k]; done[k * 2 + 2] = false;
		}
		done[k] = true;
	}
	
	void update(int a, int b, T x, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		eval(k, l, r);
		
		if (a >= r || b <= l) return;
		if (a <= l && r <= b) {
			lazy[k] = x; done[k] = false;
			eval(k, l, r);
		}
		else {
			update(a, b, x, k * 2 + 1, l, (l + r) / 2);
			update(a, b, x, k * 2 + 2, (l + r) / 2, r);
			node[k] = min(node[k * 2 + 1], node[k * 2 + 2]);
		}
	}
	
	T query(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		eval(k, l, r);
		
		if (a >= r || b <= l) return init_val;
		if (a <= l && r <= b) return node[k];
		
		T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
};

int main() {
	int n, q;
	cin >> n >> q;
	
	LazySegTree<ll> st(n, (1ll<<31) - 1);
	
	while (q--) {
		int a, b, c, d;
		cin >> a >> b >> c;
		if (a == 0) {
			cin >> d;
			st.update(b, c + 1, d);
		}
		else {
			cout << st.query(b, c + 1) << endl;
		}
	}
	return 0;
}