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;

struct node
{
	int num,l,r,ls,rs,lazy;
	node(int _l,int _r)
	{
		num=INT_MAX;
		l=_l;
		r=_r;
	}
};

vector<node> T;

int make(int l,int r)
{
	int id=T.size();
	T.push_back(node(l,r));
	T[id].ls=(l+1==r?-1:make(l,(l+r)/2));
	T[id].rs=(l+1==r?-1:make((l+r)/2,r));
	return id;
}

void update(int id,int l,int r,int t)
{
	//printf("|%d %d %d %d\n",id,l,r,t);
	if(l==r||T[id].l>=r||T[id].r<=l)
		return ;
	if(T[id].l>=l&&T[id].r<=r)
	{
		T[id].num=t;
		return ;
	}
	int mid=(T[id].l+T[id].r)>>1;
	if(T[id].num>=0)
		T[T[id].ls].num=T[T[id].rs].num=T[id].num;
	if(l<mid)
		update(T[id].ls,l,r,t);
	if(r>mid)
		update(T[id].rs,l,r,t);
	T[id].num=-1;
}

int getmin(int id,int l,int r)
{
	if(l==r||T[id].l>=r||T[id].r<=l)
		return INT_MAX; 
	if(T[id].num>=0)
		return T[id].num;
	int mid=(T[id].l+T[id].r)>>1,mi=INT_MAX;
	if(l<mid)
		mi=min(mi,getmin(T[id].ls,l,r));
	if(r>mid)
		mi=min(mi,getmin(T[id].rs,l,r));
	return mi;
}

int main()
{
	T.reserve(200100);
	int n,q;
	scanf("%d%d",&n,&q);
	make(0,n);
	for(int i=0;i<q;i++)
	{
		int com;
		scanf("%d",&com);
		if(com==0)
		{
			int s,t,x;
			scanf("%d%d%d",&s,&t,&x);
			update(0,s,t+1,x);
		//	for(int i=0;i<T.size();i++) printf("%d %d %d %d %d %d\n",i,T[i].num,T[i].l,T[i].r,T[i].ls,T[i].rs);
		}
		else
		{
			int s,t;
			scanf("%d%d",&s,&t);
			printf("%d\n",getmin(0,s,t+1));
		}
	}
}
/*
20 100
0 4 14 3
0 6 12 6
1 14 18
*/