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<string>
#include<set>
#include<utility>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<stack>

//#include"gap.h"

using namespace std;

const int int_max = 2147483647;


int N, Q, MaxN = 1;
vector<int> seg, lazy;
vector<bool> flag;

void solve(int k, int l, int r){
	if(flag[k]){

		seg[k] = lazy[k];

		if(r - l > 1){
			lazy[2*k+1] = lazy[k];
			flag[2*k+1] = true;
			lazy[2*k+2] = lazy[k];
			flag[2*k+2] = true;
		}

		flag[k] = false;
	}
}

void update(int s, int t, int x, int k, int l, int r){
	solve(k, l , r);

	if(r <= s || t <= l) return;
	if(s <= l && r <= t){
		lazy[k] = x;
		flag[k] = true;
		solve(k, l, r);
	}
	else{
		update(s, t, x, 2*k+1, l, (l+r)/2);
		update(s, t, x, 2*k+2, (l+r)/2, r);

		seg[k] = min(seg[2*k+1], seg[2*k+2]);
	}
}

int find(int s, int t, int k, int l, int r){
	solve(k, l, r);

	if(r <= s || t <= l) return int_max;

	solve(k, l, r);
	if(s <= l && r <= t){
		return seg[k];
	}
	else{
		int vl = find(s, t, 2*k+1, l, (l+r)/2);
		int vr = find(s, t, 2*k+2, (l+r)/2, r);

		return min(vl, vr);
	}
}

int main(){
	cin >> N >> Q;

	while (N > MaxN)
	{
		MaxN *= 2;
	}

	seg.resize(MaxN*2-1, int_max);
	lazy.resize(MaxN*2-1, int_max);
	flag.resize(MaxN*2-1, false);

	for(int i=0; i<Q; i++){
		int com, s, t, x;
		cin >> com;

		if(com == 0){
			cin >> s >> t >> x;
			update(s, t+1, x, 0, 0, MaxN);
		}
		if(com == 1){
			cin >> s >> t;
			cout << find(s, t+1, 0, 0, MaxN) << endl;
		}

	}


	return 0;
}