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>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % moder;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), moder - 2, moder) % moder * mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/


P dat[1000000];
int size_ = 1;
void init(int x) {
	while (size_ < x)size_ *= 2;
	rep(i, 2 * size_ - 1)dat[i] = { ((int)(1) << 31) - 1,inf };
}
void eval(int k, int l, int r) {
	if (dat[k].second != inf) {
		dat[k].first = dat[k].second;
		if (r - l > 1) {
			dat[k * 2 + 1].second = dat[k].second;
			dat[k * 2 + 2].second = dat[k].second;
		}
		dat[k].second = inf;
	}
}
void update(int a, int b, int k, int x, int l, int r) {
	eval(k, l, r);
	if (r <= a || b <= l)return;
	if (a <= l && r <= b) {
		dat[k].second = x;
		eval(k, l, r);
	}
	else {
		update(a, b, k * 2 + 1, x, l, (l + r) / 2);
		update(a, b, k * 2 + 2, x, (l + r) / 2, r);
		dat[k].first = min(dat[k * 2 + 1].first, dat[k * 2 + 2].first);
	}
}
int query(int a, int b, int k, int l, int r) {
	eval(k, l, r);
	if (r <= a || b <= l)return inf;
	if (a <= l && r <= b) {
		return dat[k].first;
	}
	int lv = query(a, b, k * 2 + 1, l, (l + r) / 2);
	int rv = query(a, b, k * 2 + 2, (l + r) / 2, r);
	return min(lv, rv);
}
signed main() {
	int n, q;
	cin >> n >> q;
	init(n);
	rep(i, q) {
		int a; cin >> a;
		if (!a) {
			int s, t, x; cin >> s >> t >> x;
			update(s, t + 1, 0, x, 0, size_);
		}
		else {
			int s, t; cin >> s >> t;
			cout << query(s, t + 1, 0, 0, size_) << endl;
		}
	}
}