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 dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
	typedef long long ll;
	#define fi first
	#define se second
	#define sc scanf
	#define pr printf
	#define pb push_back
	const ll inf = 1e18;
	const int nax = 2e6 + 7;
	ll mod;
	int n , q;
	using namespace std;
	ll exp(ll a , ll b){
		if(b == 0)	return 1;
		int x = b % 2 == 0 ?   ((exp(a , b/2)%mod)*(exp(a , b / 2)%mod))%mod :  (a%mod*exp(a , b - 1) % mod)%mod;
		return x;
	}
	ll tree[nax];
	ll arr[nax];
	int marked[nax];
	void build(ll tl , ll tr , ll pos){
		if(tl == tr)
		{
			tree[pos] = arr[tl];
			return ;
		}
		ll mid = tl + (tr - tl)/2;
		build(tl , mid , 2 * pos);
		build(mid + 1 , tr , 2 * pos + 1);
		tree[pos] = min(tree[2*pos] , tree[2*pos+1]);
	}
	void update(ll l , ll r , ll val , ll tl , ll tr , ll pos){
		if(l > r)
			return ;
		if(tl == l && tr == r){
			tree[pos] = val;
			marked[pos] = 1;
			return ;
		}
		ll mid = tl + (tr - tl)/2;
		if(marked[pos]){
			tree[2 * pos] = tree[pos];
			tree[2*pos + 1] = tree[pos];
			marked[pos*2] = marked[pos*2 + 1] = 1;
			marked[pos] = 0;
		}
		update(l , min(r , mid),val ,  tl , mid , 2 * pos );
		update(max(l , mid + 1), r , val , mid + 1 , tr , 2 * pos + 1);
		tree[pos] = min(tree[2*pos] , tree[2*pos+1]);
	}
	ll query(ll l ,ll  r,  ll tl , ll tr , ll pos){
		if(l > r)	
			return inf;
		if(tl == l && tr == r)
			return tree[pos];
		ll mid = tl + (tr - tl)/2;
		if(marked[pos]){
			tree[2 * pos] = tree[pos];
			tree[2*pos + 1] = tree[pos];
			marked[pos*2] = marked[pos*2 + 1] = 1;
			marked[pos] = 0;	
		}
		return min(query(l , min(r , mid) , tl , mid , 2*pos) , query(max(l , mid + 1), r , mid + 1 , tr , 2*pos + 1));	
	}
	int main(int argc,char ** argv){
		dhoom;

		cin >> n >> q;
		ll x = pow(2LL , 31LL) - 1;
	//	cout << "HEY" << endl;
		//cout << x << endl;
		for(int i = 1 ; i <= n ; i++)
			arr[i] = x;
		//cout << "building" << endl;
		build(1 , n , 1);
		//cout << " hi " << endl;
		for(int i = 0 ; i < q ; i++){
			ll a , b , c , d;
			cin >> a;
			if(a == 0){
					cin >> b >> c >> d;
					update(b+1 , c+1 , d , 1 , n , 1);
			}
			else
			{
					cin >> b >> c;
					cout << query(b + 1,c + 1 , 1 , n , 1) << endl;
			}
		}
		return 0;
	}