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:
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 2147483647;
int const TREE_SIZE = 1 << 20;
long long int seg_tree[TREE_SIZE];
bool is_a[TREE_SIZE];

int find(int a, int b, int index, int l, int r){
	
	// [a, b) の最小値を求める
	if(r <= a || b <= l){
		return INF;
	}
	if(a <= l && r <= b){
		return seg_tree[index];
	}
	if(is_a[index]){
		return seg_tree[index];
	}
	int ret = INF;
	ret = min(ret, find(a, b, index * 2, l, (l + r) / 2));
	ret = min(ret, find(a, b, index * 2 + 1, (l + r) / 2, r));
	return ret;
}

int update(int a, int b, int index, int num, int l, int r){
	
	// [a, b) を num に変更する
	
	if(r <= a || b <= l){
		return seg_tree[index];
	}
	if(a <= l && r <= b){
		seg_tree[index] = num;
		is_a[index] = true;
		return num;
	}
	int ret = INF;
	if(is_a[index]){
		is_a[index * 2] = true;
		seg_tree[index * 2] = seg_tree[index];
		is_a[index * 2 + 1] = true;
		seg_tree[index * 2 + 1] = seg_tree[index];
		is_a[index] = false;
		ret = seg_tree[index];
	}
	ret = min(ret, update(a, b, index * 2, num, l, (l + r) / 2));
	ret = min(ret, update(a, b, index * 2 + 1, num, (l + r) / 2, r));
	return seg_tree[index] = ret;
}

int main(){
	
	int n, q;
	cin >> n >> q;
	
	for(int i = 0; i < TREE_SIZE; i++){
		seg_tree[i] = INF;
		is_a[i] = false;
	}
	is_a[1] = true;
	
	for(int i = 0; i < q; i++){
		long long int num, a, b, c;
		cin >> num;
		if(num == 0){
			cin >> a >> b >> c;
			update(a, b + 1, 1, c, 0, TREE_SIZE / 2);
		}else{
			cin >> a >> b;
			cout << find(a, b + 1, 1, 0, TREE_SIZE / 2) << endl;
		}
	}
	
	return 0;
}