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 <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define INF 2147483647
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, q;
vector<int> dat, lazy;
void init(int n_) {
	int x = 1;
	while (x < n_)x *= 2;
	n = x;
	dat.resize(2 * n - 1, INF);
	lazy.resize(2 * n - 1, INF);
}

void eval(int k) {
	if (lazy[k] == INF)return;
	if (k < n - 1) {
		lazy[2 * k + 1] = lazy[k];
		lazy[2 * k + 2] = lazy[k];
	}
	dat[k] = lazy[k];
	lazy[k] = INF;
}

void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
	if (r < 0)r = n;
	eval(k);
	if (a <= l && r <= b) {
		lazy[k] = x;
		eval(k);
	}
	else if (a < r&&l < b) {
		update(a, b, x, 2 * k + 1, l, (l + r) / 2);
		update(a, b, x, 2 * k + 2, (l + r) / 2, r);
		dat[k] = min(dat[2 * k + 1], dat[2 * k + 2]);
	}
}

int query(int a, int b, int k = 0, int l = 0, int r = -1) {
	if (r < 0)r = n;
	eval(k);
	if (r <= a || b <= l)return INF;
	if (a <= l && r <= b)return dat[k];
	int vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
	int vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
	return min(vl, vr);
}



signed main() {
	cin >> n >> q;
	init(n);
	for (int i = 0; i < q; i++) {
		int a;
		cin >> a;
		if (!a) {
			int b, c, d;
			cin >> b >> c >> d;
			update(b, c + 1, d);
		}
		else {
			int b, c;
			cin >> b >> c;
			cout << query(b, c + 1) << endl;
		}
	}
}