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_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

// ????????´??°?????????????°?????????¶?????°??????????????????
const int MAX_N = 1<<20;
struct RMQRUQ {
  int n, dat[MAX_N*2-1], lazy[MAX_N*2-1];
  bool flag[MAX_N*2-1];
  RMQRUQ(){}
  RMQRUQ(int n_) {init(n_);}
  void init(int n_) {
    n = 1; while(n < n_) n *= 2;
    REP(i, n*2-1) dat[i] = INT_MAX, lazy[i] = 0, flag[i] = false;
  }
  void eval(int k, int l, int r) {
    if(flag[k]) {
      dat[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 a, int b, ll x) {update(a,b,x,0,0,n);}
  void update(int a, int b, ll x, int k, int l, int r) {
    eval(k, l, r);
    if(b <= l || r <= a) return;
    if(a <= l && r <= b) {
      lazy[k] = x;
      flag[k] = true;
      eval(k, l, r);
    } else {
      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]);
    }
  }
  ll query(int a, int b) {return query(a,b,0,0,n);}
  ll query(int a, int b, int k, int l, int r) {
    eval(k, l, r);
    if(b <= l || r <= a) {
      return INT_MAX;
    }
    if(a <= l && r <= b) {
      return dat[k];
    }
    ll vl = query(a, b, 2*k+1, l, (l+r)/2);
    ll vr = query(a, b, 2*k+2, (l+r)/2, r);
    return min(vl, vr);
  }
};

RMQRUQ seg;
signed main(void)
{
  int n;
  cin >> n;
  seg.init(n);
  int q;
  cin >> q;
  REP(i, q) {
    int a;
    cin >> a;
    if(!a) {
      int s, t, x;
      cin >> s >> t >> x;
      t++;
      seg.update(s, t, x);
    } else {
      int s, t;
      cin >> s >> t;
      t++;
      cout << seg.query(s, t) << endl;
    }
  }

  return 0;
}