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>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

//=============Segment_Tree_with_Lazy_Propagation====
const int MAX_N = 1 << 17;
int n;
ll initial = pow(2, 31) - 1;
vector<ll> dat(2 * MAX_N - 1, initial);
vector<ll> lazy(2 * MAX_N - 1, initial);

void init(ll n_) {
  n = 1;
  while (n < n_) {
    n *= 2;
  }
}

void eval(ll k, ll l, ll r) {
  if (lazy.at(k) != initial) {
    dat.at(k) = lazy.at(k);
    if (r - l > 1) {
      lazy.at(k * 2 + 1) = lazy.at(k);
      lazy.at(k * 2 + 2) = lazy.at(k);
    }
    lazy.at(k) = initial;
  }
}

void update(ll a, ll b, ll plus, ll k = 0, ll l = 0, ll r = n) {
  if (r <= a || b <= l) {
    eval(k, l, r);//子供のlazyを更新する必要がある
    return;
  }
  if (a <= l && r <= b) {
    lazy.at(k) = plus;
    eval(k, l, r);//子供のlazyを更新する必要がある
  }
  else {
    eval(k, l, r);//updateで使う子供のlazeとdat.at(k)の更新
    update(a, b, plus, k * 2 + 1, l, (l + r) / 2);
    update(a, b, plus, k * 2 + 2, (l + r) / 2, r);
    dat.at(k) = min(dat.at(2 * k + 1), dat.at(2 * k + 2));
  }
}

ll query(ll a, ll b, ll k = 0, ll l = 0, ll r = n) {
  if (r <= a || b <= l) {
    return INF;
  }
  eval(k, l, r);//dat.at(k)と子供のlazy更新のためreturn datとqueryに必要
  if (a <= l && r <= b) {
    return dat.at(k);
  }
  else {
    ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return min(vl, vr);
  }
}
//=================================================

int main() {
  ll q;
  cin >> n >> q;
  init(n);
  for (ll i = 0; i < q; ++i) {
    ll com;
    cin >> com;
    if (com == 0) {
      ll s, t, x;
      cin >> s >> t >> x;
      update(s, t + 1, x);
    }
    else {
      ll s, t;
      cin >> s >> t;
      cout << query(s, t + 1) << "\n";
    }
  }
}