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 <iostream>
#include <algorithm>
using namespace std;
#define INF 2147483647
//static const double INF = (1 << 31)-1;

int n,q;
double d[400000],lazy[400000];
double x;

void lazy_evaluate(int k,int l,int r){
	if(lazy[k] == INF)return;
	else{
		d[k] = lazy[k];
		if(r - l > 1){
			lazy[2*k+1] = lazy[k];
			lazy[2*k+2] = lazy[k];
			/*
			lazy_evaluate(2*k+1);
			lazy_evaluate(2*k+2);
			*/
		}
		lazy[k] = INF;
	}
}
/*
void update(int k,double a){
	k += n - 1;
	d[k] = a;
	while(k > 0){
		k = (k - 1)/2;
		d[k] = min(d[k*2+1], d[k*2+2]);
	}
}
*/
void query(int a, int b, int k=0, int l=0, int r=-1){
	if(r < 0){
		r = n;
	}
	//cout << "haittemasu" << endl;
	
	lazy_evaluate(k,l,r);
	if(b <= l || r <= a) return;
	else if(a <= l && r <= b){
		lazy[k] = x;
		lazy_evaluate(k,l,r);
	}
	else{
		query(a,b,2*k+1,l,(l+r)/2);
		query(a,b,2*k+2,(l+r)/2,r);
		d[k] = min(d[2*k+1], d[2*k+2]);
	}
}

/*
double query(int a, int b, int k, int l, int r){
	if(r <= a || b <= l){
		return INF;
	}
	else if(a <= l && r <= b){
		return d[k];
	}

	double vl = query(a, b, k*2+1, l, (l + r)/2);
	double vr = query(a, b, k*2+2, (l + r)/2, r);
	return min(vl, vr);
}

double findMin(int a, int b){
	return query(a, b+1, 0, 0, n);
}
*/

double find(int a, int b, int k=0, int l=0, int r=-1){
	if(r < 0){
		r = n;
	}
	lazy_evaluate(k,l,r);
	if(b <= l || r <= a){
		return INF;
	}
	else if(a <= l && r <= b){
		return d[k];
	}

	double vl = find(a, b, k*2+1, l, (l + r)/2);
	double vr = find(a, b, k*2+2, (l + r)/2, r);
	return min(vl, vr);

}

int main(){
	int n_;
	cin >> n_ >> q;

	n=1;
	while(n<n_){
		n*=2;
	}
	for(int i = 0;i < n*2-1;i++){
		d[i] = INF;
		lazy[i] = INF;
	}
	int a, b, c;  
	double s,t;
	for(int i = 0;i < q;i++){
		cin >> a;
		if(a == 0){
			cin >> s >> t >> x;
			query(s,t+1);
		}
		else{
			cin >> b >> c;
			printf("%.0f\n",find(b,c+1));
		}
	}
	/*
	for(int i = 0;i < n*2-1;i++){
		cout << d[i] << endl;
	}
	*/
	return 0;
}